| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 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 "GrPictureUtils.h" | 8 #include "GrPictureUtils.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const SkPath& path, const SkMatrix* matrix, | 103 const SkPath& path, const SkMatrix* matrix, |
| 104 const SkPaint& paint) SK_OVERRIDE { | 104 const SkPaint& paint) SK_OVERRIDE { |
| 105 } | 105 } |
| 106 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, int vert
exCount, | 106 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, int vert
exCount, |
| 107 const SkPoint verts[], const SkPoint texs[], | 107 const SkPoint verts[], const SkPoint texs[], |
| 108 const SkColor colors[], SkXfermode* xmode, | 108 const SkColor colors[], SkXfermode* xmode, |
| 109 const uint16_t indices[], int indexCount, | 109 const uint16_t indices[], int indexCount, |
| 110 const SkPaint& paint) SK_OVERRIDE { | 110 const SkPaint& paint) SK_OVERRIDE { |
| 111 } | 111 } |
| 112 virtual void drawDevice(const SkDraw& draw, SkBaseDevice* deviceIn, int x, i
nt y, | 112 virtual void drawDevice(const SkDraw& draw, SkBaseDevice* deviceIn, int x, i
nt y, |
| 113 const SkPaint&) SK_OVERRIDE { | 113 const SkPaint& paint) SK_OVERRIDE { |
| 114 // deviceIn is the one that is being "restored" back to its parent |
| 114 GrGatherDevice* device = static_cast<GrGatherDevice*>(deviceIn); | 115 GrGatherDevice* device = static_cast<GrGatherDevice*>(deviceIn); |
| 115 | 116 |
| 116 if (device->fAlreadyDrawn) { | 117 if (device->fAlreadyDrawn) { |
| 117 return; | 118 return; |
| 118 } | 119 } |
| 119 | 120 |
| 120 device->fInfo.fRestoreOpID = fPicture->EXPERIMENTAL_curOpID(); | 121 device->fInfo.fRestoreOpID = fPicture->EXPERIMENTAL_curOpID(); |
| 122 device->fInfo.fOrigin = device->getOrigin(); |
| 123 // TODO: this has to be a deep copy (until the world is immutable) |
| 124 device->fInfo.fPaint = SkNEW_ARGS(SkPaint, (paint)); |
| 125 |
| 121 fAccelData->addSaveLayerInfo(device->fInfo); | 126 fAccelData->addSaveLayerInfo(device->fInfo); |
| 122 device->fAlreadyDrawn = true; | 127 device->fAlreadyDrawn = true; |
| 123 } | 128 } |
| 124 // TODO: allow this call to return failure, or move to SkBitmapDevice only. | 129 // TODO: allow this call to return failure, or move to SkBitmapDevice only. |
| 125 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE { | 130 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE { |
| 126 return fEmptyBitmap; | 131 return fEmptyBitmap; |
| 127 } | 132 } |
| 128 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | 133 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG |
| 129 virtual bool onReadPixels(const SkBitmap& bitmap, | 134 virtual bool onReadPixels(const SkBitmap& bitmap, |
| 130 int x, int y, | 135 int x, int y, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { | 242 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { |
| 238 if (0 == pict->width() || 0 == pict->height()) { | 243 if (0 == pict->width() || 0 == pict->height()) { |
| 239 return ; | 244 return ; |
| 240 } | 245 } |
| 241 | 246 |
| 242 GrGatherDevice device(pict->width(), pict->height(), pict, accelData); | 247 GrGatherDevice device(pict->width(), pict->height(), pict, accelData); |
| 243 GrGatherCanvas canvas(&device, pict); | 248 GrGatherCanvas canvas(&device, pict); |
| 244 | 249 |
| 245 canvas.gather(); | 250 canvas.gather(); |
| 246 } | 251 } |
| OLD | NEW |