OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 SkBitmap srcBM; | 1139 SkBitmap srcBM; |
1140 | 1140 |
1141 #if SK_SUPPORT_GPU | 1141 #if SK_SUPPORT_GPU |
1142 GrRenderTarget* srcRT = src->accessRenderTarget(); | 1142 GrRenderTarget* srcRT = src->accessRenderTarget(); |
1143 if (srcRT && !srcRT->asTexture() && dst->accessRenderTarget()) { | 1143 if (srcRT && !srcRT->asTexture() && dst->accessRenderTarget()) { |
1144 // When both the src & the dst are on the gpu but the src doesn't have a
texture, | 1144 // When both the src & the dst are on the gpu but the src doesn't have a
texture, |
1145 // we create a temporary texture for the draw. | 1145 // we create a temporary texture for the draw. |
1146 // TODO: we should actually only copy the portion of the source needed t
o apply the image | 1146 // TODO: we should actually only copy the portion of the source needed t
o apply the image |
1147 // filter | 1147 // filter |
1148 GrContext* context = srcRT->getContext(); | 1148 GrContext* context = srcRT->getContext(); |
1149 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(sr
cRT->desc(), true)); | 1149 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(sr
cRT->desc(), |
| 1150 Sk
Budgeted::kYes)); |
1150 | 1151 |
1151 context->copySurface(tex, srcRT); | 1152 context->copySurface(tex, srcRT); |
1152 | 1153 |
1153 GrWrapTextureInBitmap(tex, src->width(), src->height(), src->isOpaque(),
&srcBM); | 1154 GrWrapTextureInBitmap(tex, src->width(), src->height(), src->isOpaque(),
&srcBM); |
1154 } else | 1155 } else |
1155 #endif | 1156 #endif |
1156 { | 1157 { |
1157 srcBM = src->accessBitmap(false); | 1158 srcBM = src->accessBitmap(false); |
1158 } | 1159 } |
1159 | 1160 |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 } | 3001 } |
3001 | 3002 |
3002 if (matrix) { | 3003 if (matrix) { |
3003 canvas->concat(*matrix); | 3004 canvas->concat(*matrix); |
3004 } | 3005 } |
3005 } | 3006 } |
3006 | 3007 |
3007 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3008 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3008 fCanvas->restoreToCount(fSaveCount); | 3009 fCanvas->restoreToCount(fSaveCount); |
3009 } | 3010 } |
OLD | NEW |