OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * This device will route all bitmaps (primitives and in shaders) to its PRSet. | 47 * This device will route all bitmaps (primitives and in shaders) to its PRSet. |
48 * It should never actually draw anything, so there need not be any pixels | 48 * It should never actually draw anything, so there need not be any pixels |
49 * behind its device. | 49 * behind its device. |
50 */ | 50 */ |
51 class GatherPixelRefDevice : public SkBaseDevice { | 51 class GatherPixelRefDevice : public SkBaseDevice { |
52 public: | 52 public: |
53 SK_DECLARE_INST_COUNT(GatherPixelRefDevice) | 53 SK_DECLARE_INST_COUNT(GatherPixelRefDevice) |
54 | 54 |
55 GatherPixelRefDevice(int width, int height, PixelRefSet* prset) { | 55 GatherPixelRefDevice(int width, int height, PixelRefSet* prset) { |
56 fSize.set(width, height); | 56 fSize.set(width, height); |
57 fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height); | 57 fEmptyBitmap.setConfig(SkImageInfo::MakeUnknown(width, height)); |
58 fPRSet = prset; | 58 fPRSet = prset; |
59 } | 59 } |
60 | 60 |
61 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; } | 61 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; } |
62 virtual int width() const SK_OVERRIDE { return fSize.width(); } | 62 virtual int width() const SK_OVERRIDE { return fSize.width(); } |
63 virtual int height() const SK_OVERRIDE { return fSize.height(); } | 63 virtual int height() const SK_OVERRIDE { return fSize.height(); } |
64 virtual bool isOpaque() const SK_OVERRIDE { return false; } | 64 virtual bool isOpaque() const SK_OVERRIDE { return false; } |
65 virtual SkBitmap::Config config() const SK_OVERRIDE { | 65 virtual SkBitmap::Config config() const SK_OVERRIDE { |
66 return SkBitmap::kNo_Config; | 66 return SkBitmap::kNo_Config; |
67 } | 67 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 canvas.clipRect(area, SkRegion::kIntersect_Op, false); | 226 canvas.clipRect(area, SkRegion::kIntersect_Op, false); |
227 canvas.drawPicture(*pict); | 227 canvas.drawPicture(*pict); |
228 | 228 |
229 SkData* data = NULL; | 229 SkData* data = NULL; |
230 int count = array.count(); | 230 int count = array.count(); |
231 if (count > 0) { | 231 if (count > 0) { |
232 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*)
); | 232 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*)
); |
233 } | 233 } |
234 return data; | 234 return data; |
235 } | 235 } |
OLD | NEW |