Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1327)

Side by Side Diff: src/utils/SkPictureUtils.cpp

Issue 134473002: Pull in Chromium's version of GatherPixelRefs (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkGatherPixelRefsAndRects.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 static void nothing_to_do() {} 44 static void nothing_to_do() {}
45 45
46 /** 46 /**
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)
54
53 GatherPixelRefDevice(int width, int height, PixelRefSet* prset) { 55 GatherPixelRefDevice(int width, int height, PixelRefSet* prset) {
54 fSize.set(width, height); 56 fSize.set(width, height);
55 fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height); 57 fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height);
56 fPRSet = prset; 58 fPRSet = prset;
57 } 59 }
58 60
59 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; } 61 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; }
60 virtual int width() const SK_OVERRIDE { return fSize.width(); } 62 virtual int width() const SK_OVERRIDE { return fSize.width(); }
61 virtual int height() const SK_OVERRIDE { return fSize.height(); } 63 virtual int height() const SK_OVERRIDE { return fSize.height(); }
62 virtual bool isOpaque() const SK_OVERRIDE { return false; } 64 virtual bool isOpaque() const SK_OVERRIDE { return false; }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 canvas.clipRect(area, SkRegion::kIntersect_Op, false); 229 canvas.clipRect(area, SkRegion::kIntersect_Op, false);
228 canvas.drawPicture(*pict); 230 canvas.drawPicture(*pict);
229 231
230 SkData* data = NULL; 232 SkData* data = NULL;
231 int count = array.count(); 233 int count = array.count();
232 if (count > 0) { 234 if (count > 0) {
233 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) ); 235 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) );
234 } 236 }
235 return data; 237 return data;
236 } 238 }
OLDNEW
« no previous file with comments | « src/utils/SkGatherPixelRefsAndRects.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698