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

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: Fix SkProxyCanvas leak Created 8 years, 3 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool SupportsPlatformPaint(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 return platform_device && platform_device->SupportsPlatformPaint();
53 } 53 }
54 54
55 bool SupportsDirectPlatformPaint(const SkCanvas* canvas) {
56 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
57 return platform_device && platform_device->SupportsDirectPlatformPaint();
58 }
59
55 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) { 60 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
56 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 61 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
57 if (platform_device) 62 if (platform_device)
58 return platform_device->BeginPlatformPaint(); 63 return platform_device->BeginPlatformPaint();
59 64
60 return 0; 65 return 0;
61 } 66 }
62 67
63 void EndPlatformPaint(SkCanvas* canvas) { 68 void EndPlatformPaint(SkCanvas* canvas) {
64 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 69 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
(...skipping 21 matching lines...) Expand all
86 SkIntToScalar(width), SkIntToScalar(height)); 91 SkIntToScalar(width), SkIntToScalar(height));
87 SkPaint paint; 92 SkPaint paint;
88 // so we don't draw anything on a device that ignores xfermodes 93 // so we don't draw anything on a device that ignores xfermodes
89 paint.setColor(0); 94 paint.setColor(0);
90 // install our custom mode 95 // install our custom mode
91 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref(); 96 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref();
92 canvas->drawRect(rect, paint); 97 canvas->drawRect(rect, paint);
93 } 98 }
94 99
95 } // namespace skia 100 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698