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

Side by Side Diff: skia/ext/platform_canvas.cc

Issue 10915065: Add PlatformPictureSkia and RecordingPlatformDeviceSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And one more.. Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/platform_canvas.h" 5 #include "skia/ext/platform_canvas.h"
6 6
7 #include "skia/ext/bitmap_platform_device.h" 7 #include "skia/ext/bitmap_platform_device.h"
8 #include "third_party/skia/include/core/SkTypes.h" 8 #include "third_party/skia/include/core/SkTypes.h"
9 9
10 namespace skia { 10 namespace skia {
(...skipping 29 matching lines...) Expand all
40 delete canvas; 40 delete canvas;
41 canvas = NULL; 41 canvas = NULL;
42 } 42 }
43 return canvas; 43 return canvas;
44 } 44 }
45 45
46 SkDevice* GetTopDevice(const SkCanvas& canvas) { 46 SkDevice* GetTopDevice(const SkCanvas& canvas) {
47 return canvas.getTopDevice(true); 47 return canvas.getTopDevice(true);
48 } 48 }
49 49
50 bool SupportsPlatformPaint(const SkCanvas* canvas) { 50 PlatformDevice::PlatformPaint PlatformPaintSupport(const SkCanvas* canvas) {
51 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 51 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
52 return platform_device && platform_device->SupportsPlatformPaint(); 52 if (!platform_device)
53 return PlatformDevice::PLATFORM_PAINT_UNSUPPORTED;
54 return platform_device->PlatformPaintSupport();
53 } 55 }
54 56
55 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) { 57 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
56 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 58 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
57 if (platform_device) 59 if (platform_device)
58 return platform_device->BeginPlatformPaint(); 60 return platform_device->BeginPlatformPaint();
59 61
60 return 0; 62 return 0;
61 } 63 }
62 64
(...skipping 23 matching lines...) Expand all
86 SkIntToScalar(width), SkIntToScalar(height)); 88 SkIntToScalar(width), SkIntToScalar(height));
87 SkPaint paint; 89 SkPaint paint;
88 // so we don't draw anything on a device that ignores xfermodes 90 // so we don't draw anything on a device that ignores xfermodes
89 paint.setColor(0); 91 paint.setColor(0);
90 // install our custom mode 92 // install our custom mode
91 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref(); 93 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref();
92 canvas->drawRect(rect, paint); 94 canvas->drawRect(rect, paint);
93 } 95 }
94 96
95 } // namespace skia 97 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698