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

Side by Side Diff: src/utils/SkGatherPixelRefsAndRects.h

Issue 168653002: Change device factories to take SkImageInfo instead of SkBitmap::Config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix PdfViewer Created 6 years, 10 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/SkDeferredCanvas.cpp ('k') | src/utils/SkPictureUtils.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 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 #ifndef SkGatherPixelRefsAndRects_DEFINED 8 #ifndef SkGatherPixelRefsAndRects_DEFINED
9 #define SkGatherPixelRefsAndRects_DEFINED 9 #define SkGatherPixelRefsAndRects_DEFINED
10 10
(...skipping 10 matching lines...) Expand all
21 // device bounds to the user provided SkPixelRefContainer-derived object 21 // device bounds to the user provided SkPixelRefContainer-derived object
22 class SkGatherPixelRefsAndRectsDevice : public SkBaseDevice { 22 class SkGatherPixelRefsAndRectsDevice : public SkBaseDevice {
23 public: 23 public:
24 SK_DECLARE_INST_COUNT(SkGatherPixelRefsAndRectsDevice) 24 SK_DECLARE_INST_COUNT(SkGatherPixelRefsAndRectsDevice)
25 25
26 SkGatherPixelRefsAndRectsDevice(int width, int height, 26 SkGatherPixelRefsAndRectsDevice(int width, int height,
27 SkPictureUtils::SkPixelRefContainer* prCont) { 27 SkPictureUtils::SkPixelRefContainer* prCont) {
28 fSize.set(width, height); 28 fSize.set(width, height);
29 fPRCont = prCont; 29 fPRCont = prCont;
30 SkSafeRef(fPRCont); 30 SkSafeRef(fPRCont);
31 fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height); 31 fEmptyBitmap.setConfig(SkImageInfo::Make(width, height,
32 kUnknown_SkColorType,
33 kIgnore_SkAlphaType));
32 } 34 }
33 35
34 virtual ~SkGatherPixelRefsAndRectsDevice() { 36 virtual ~SkGatherPixelRefsAndRectsDevice() {
35 SkSafeUnref(fPRCont); 37 SkSafeUnref(fPRCont);
36 } 38 }
37 39
38 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; } 40 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; }
39 41
40 virtual int width() const SK_OVERRIDE { return fSize.width(); } 42 virtual int width() const SK_OVERRIDE { return fSize.width(); }
41 virtual int height() const SK_OVERRIDE { return fSize.height(); } 43 virtual int height() const SK_OVERRIDE { return fSize.height(); }
42 virtual bool isOpaque() const SK_OVERRIDE { return false; } 44 virtual bool isOpaque() const SK_OVERRIDE { return false; }
43 virtual SkBitmap::Config config() const SK_OVERRIDE { 45 virtual SkBitmap::Config config() const SK_OVERRIDE {
44 return SkBitmap::kNo_Config; 46 return SkBitmap::kNo_Config;
45 } 47 }
48 virtual SkImageInfo imageInfo() const SK_OVERRIDE {
49 return fEmptyBitmap.info();
50 }
51
46 virtual void writePixels(const SkBitmap& bitmap, int x, int y, 52 virtual void writePixels(const SkBitmap& bitmap, int x, int y,
47 SkCanvas::Config8888 config8888) SK_OVERRIDE { 53 SkCanvas::Config8888 config8888) SK_OVERRIDE {
48 NotSupported(); 54 NotSupported();
49 } 55 }
50 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } 56 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
51 57
52 protected: 58 protected:
53 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { 59 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
54 return false; 60 return false;
55 } 61 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return SkShader::kNone_BitmapType != shader->asABitmap(bitmap, N ULL, NULL); 325 return SkShader::kNone_BitmapType != shader->asABitmap(bitmap, N ULL, NULL);
320 } 326 }
321 } 327 }
322 return false; 328 return false;
323 } 329 }
324 330
325 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE { 331 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE {
326 NotSupported(); 332 NotSupported();
327 } 333 }
328 334
329 virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, 335 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S K_OVERRIDE {
330 int width, int height,
331 bool isOpaque,
332 Usage usage) SK_OVERRIDE {
333 // we expect to only get called via savelayer, in which case it is fine. 336 // we expect to only get called via savelayer, in which case it is fine.
334 SkASSERT(kSaveLayer_Usage == usage); 337 SkASSERT(kSaveLayer_Usage == usage);
335 return SkNEW_ARGS(SkGatherPixelRefsAndRectsDevice, (width, height, fPRCo nt)); 338 return SkNEW_ARGS(SkGatherPixelRefsAndRectsDevice,
339 (info.width(), info.height(), fPRCont));
336 } 340 }
337 341
338 virtual void flush() SK_OVERRIDE {} 342 virtual void flush() SK_OVERRIDE {}
339 343
340 static void NotSupported() { 344 static void NotSupported() {
341 SkDEBUGFAIL("this method should never be called"); 345 SkDEBUGFAIL("this method should never be called");
342 } 346 }
343 347
344 static void NothingToDo() {} 348 static void NothingToDo() {}
345 349
346 typedef SkBaseDevice INHERITED; 350 typedef SkBaseDevice INHERITED;
347 }; 351 };
348 352
349 #endif // SkGatherPixelRefsAndRects_DEFINED 353 #endif // SkGatherPixelRefsAndRects_DEFINED
OLDNEW
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698