1 /*
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 new OGLSwToSurfaceBlit(SurfaceType.IntArgbPre,
55 OGLSurfaceData.PF_INT_ARGB_PRE);
56 Blit blitIntArgbPreToTexture =
57 new OGLSwToTextureBlit(SurfaceType.IntArgbPre,
58 OGLSurfaceData.PF_INT_ARGB_PRE);
59
60 GraphicsPrimitive[] primitives = {
61 // surface->surface ops
62 new OGLSurfaceToSurfaceBlit(),
63 new OGLSurfaceToSurfaceScale(),
64 new OGLSurfaceToSurfaceTransform(),
65
66 // render-to-texture surface->surface ops
67 new OGLRTTSurfaceToSurfaceBlit(),
68 new OGLRTTSurfaceToSurfaceScale(),
69 new OGLRTTSurfaceToSurfaceTransform(),
70
71 // surface->sw ops
72 new OGLSurfaceToSwBlit(SurfaceType.IntArgb,
73 OGLSurfaceData.PF_INT_ARGB),
74
75 // sw->surface ops
76 blitIntArgbPreToSurface,
77 new OGLSwToSurfaceBlit(SurfaceType.IntRgb,
78 OGLSurfaceData.PF_INT_RGB),
79 new OGLSwToSurfaceBlit(SurfaceType.IntRgbx,
80 OGLSurfaceData.PF_INT_RGBX),
81 new OGLSwToSurfaceBlit(SurfaceType.IntBgr,
82 OGLSurfaceData.PF_INT_BGR),
83 new OGLSwToSurfaceBlit(SurfaceType.IntBgrx,
84 OGLSurfaceData.PF_INT_BGRX),
85 new OGLSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
86 OGLSurfaceData.PF_3BYTE_BGR),
87 new OGLSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
88 OGLSurfaceData.PF_USHORT_565_RGB),
89 new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
90 OGLSurfaceData.PF_USHORT_555_RGB),
91 new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgbx,
92 OGLSurfaceData.PF_USHORT_555_RGBX),
93 new OGLSwToSurfaceBlit(SurfaceType.ByteGray,
488 OGLRTTSurfaceToSurfaceTransform() {
489 super(OGLSurfaceData.OpenGLSurfaceRTT,
490 CompositeType.AnyAlpha,
491 OGLSurfaceData.OpenGLSurface);
492 }
493
494 public void Transform(SurfaceData src, SurfaceData dst,
495 Composite comp, Region clip,
496 AffineTransform at, int hint,
497 int sx, int sy, int dx, int dy, int w, int h)
498 {
499 OGLBlitLoops.IsoBlit(src, dst,
500 null, null,
501 comp, clip, at, hint,
502 sx, sy, sx+w, sy+h,
503 dx, dy, dx+w, dy+h,
504 true);
505 }
506 }
507
508 class OGLSurfaceToSwBlit extends Blit {
509
510 private int typeval;
511
512 // REMIND: destination will actually be opaque/premultiplied...
513 OGLSurfaceToSwBlit(SurfaceType dstType, int typeval) {
514 super(OGLSurfaceData.OpenGLSurface,
515 CompositeType.SrcNoEa,
516 dstType);
517 this.typeval = typeval;
518 }
519
520 public void Blit(SurfaceData src, SurfaceData dst,
521 Composite comp, Region clip,
522 int sx, int sy, int dx, int dy,
523 int w, int h)
524 {
525 OGLRenderQueue rq = OGLRenderQueue.getInstance();
526 rq.lock();
527 try {
528 // make sure the RenderQueue keeps a hard reference to the
529 // destination (sysmem) SurfaceData to prevent it from being
530 // disposed while the operation is processed on the QFT
531 rq.addReference(dst);
532
533 RenderBuffer buf = rq.getBuffer();
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 new OGLSwToSurfaceBlit(SurfaceType.IntArgbPre,
55 OGLSurfaceData.PF_INT_ARGB_PRE);
56 Blit blitIntArgbPreToTexture =
57 new OGLSwToTextureBlit(SurfaceType.IntArgbPre,
58 OGLSurfaceData.PF_INT_ARGB_PRE);
59
60 GraphicsPrimitive[] primitives = {
61 // surface->surface ops
62 new OGLSurfaceToSurfaceBlit(),
63 new OGLSurfaceToSurfaceScale(),
64 new OGLSurfaceToSurfaceTransform(),
65
66 // render-to-texture surface->surface ops
67 new OGLRTTSurfaceToSurfaceBlit(),
68 new OGLRTTSurfaceToSurfaceScale(),
69 new OGLRTTSurfaceToSurfaceTransform(),
70
71 // surface->sw ops
72 new OGLSurfaceToSwBlit(SurfaceType.IntArgb,
73 OGLSurfaceData.PF_INT_ARGB),
74 new OGLSurfaceToSwBlit(SurfaceType.IntArgbPre,
75 OGLSurfaceData.PF_INT_ARGB_PRE),
76
77 // sw->surface ops
78 blitIntArgbPreToSurface,
79 new OGLSwToSurfaceBlit(SurfaceType.IntRgb,
80 OGLSurfaceData.PF_INT_RGB),
81 new OGLSwToSurfaceBlit(SurfaceType.IntRgbx,
82 OGLSurfaceData.PF_INT_RGBX),
83 new OGLSwToSurfaceBlit(SurfaceType.IntBgr,
84 OGLSurfaceData.PF_INT_BGR),
85 new OGLSwToSurfaceBlit(SurfaceType.IntBgrx,
86 OGLSurfaceData.PF_INT_BGRX),
87 new OGLSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
88 OGLSurfaceData.PF_3BYTE_BGR),
89 new OGLSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
90 OGLSurfaceData.PF_USHORT_565_RGB),
91 new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
92 OGLSurfaceData.PF_USHORT_555_RGB),
93 new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgbx,
94 OGLSurfaceData.PF_USHORT_555_RGBX),
95 new OGLSwToSurfaceBlit(SurfaceType.ByteGray,
490 OGLRTTSurfaceToSurfaceTransform() {
491 super(OGLSurfaceData.OpenGLSurfaceRTT,
492 CompositeType.AnyAlpha,
493 OGLSurfaceData.OpenGLSurface);
494 }
495
496 public void Transform(SurfaceData src, SurfaceData dst,
497 Composite comp, Region clip,
498 AffineTransform at, int hint,
499 int sx, int sy, int dx, int dy, int w, int h)
500 {
501 OGLBlitLoops.IsoBlit(src, dst,
502 null, null,
503 comp, clip, at, hint,
504 sx, sy, sx+w, sy+h,
505 dx, dy, dx+w, dy+h,
506 true);
507 }
508 }
509
510 final class OGLSurfaceToSwBlit extends Blit {
511
512 private final int typeval;
513
514 // destination will actually be ArgbPre or Argb
515 OGLSurfaceToSwBlit(final SurfaceType dstType,final int typeval) {
516 super(OGLSurfaceData.OpenGLSurface,
517 CompositeType.SrcNoEa,
518 dstType);
519 this.typeval = typeval;
520 }
521
522 public void Blit(SurfaceData src, SurfaceData dst,
523 Composite comp, Region clip,
524 int sx, int sy, int dx, int dy,
525 int w, int h)
526 {
527 OGLRenderQueue rq = OGLRenderQueue.getInstance();
528 rq.lock();
529 try {
530 // make sure the RenderQueue keeps a hard reference to the
531 // destination (sysmem) SurfaceData to prevent it from being
532 // disposed while the operation is processed on the QFT
533 rq.addReference(dst);
534
535 RenderBuffer buf = rq.getBuffer();
|