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

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

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/vector_platform_device_skia.h" 5 #include "skia/ext/vector_platform_device_skia.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/SkClipStack.h" 8 #include "third_party/skia/include/core/SkClipStack.h"
9 #include "third_party/skia/include/core/SkDraw.h" 9 #include "third_party/skia/include/core/SkDraw.h"
10 #include "third_party/skia/include/core/SkRect.h" 10 #include "third_party/skia/include/core/SkRect.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 height(), 46 height(),
47 false, /* not opaque */ 47 false, /* not opaque */
48 NULL); 48 NULL);
49 #elif defined(OS_POSIX) && !defined(OS_MACOSX) 49 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
50 raster_surface_ = BitmapPlatformDevice::Create(width(), 50 raster_surface_ = BitmapPlatformDevice::Create(width(),
51 height(), 51 height(),
52 false /* not opaque */); 52 false /* not opaque */);
53 #endif 53 #endif
54 raster_surface_->unref(); // SkRefPtr and create both took a reference. 54 raster_surface_->unref(); // SkRefPtr and create both took a reference.
55 55
56 #if defined(OS_WIN) || defined(OS_MACOSX)
57 // BitmapPlatformDevice instances are initialized to 0 by Cairo on Linux, but
58 // uninitialized on Win and Mac.
56 SkCanvas canvas(raster_surface_.get()); 59 SkCanvas canvas(raster_surface_.get());
60 canvas.clear(SkColorSetARGB(0, 0, 0, 0));
Alexei Svitkine (slow) 2012/03/15 22:49:11 This whole function is kind of nasty. Could you a
Jeff Timanus 2012/03/16 03:10:31 Done.
61 #endif
57 return raster_surface_->BeginPlatformPaint(); 62 return raster_surface_->BeginPlatformPaint();
58 } 63 }
59 64
60 void VectorPlatformDeviceSkia::EndPlatformPaint() { 65 void VectorPlatformDeviceSkia::EndPlatformPaint() {
61 DCHECK(raster_surface_ != NULL); 66 DCHECK(raster_surface_ != NULL);
62 SkPaint paint; 67 SkPaint paint;
63 // SkPDFDevice checks the passed SkDraw for an empty clip (only). Fake 68 // SkPDFDevice checks the passed SkDraw for an empty clip (only). Fake
64 // it out by setting a non-empty clip. 69 // it out by setting a non-empty clip.
65 SkDraw draw; 70 SkDraw draw;
66 SkRegion clip(SkIRect::MakeWH(width(), height())); 71 SkRegion clip(SkIRect::MakeWH(width(), height()));
(...skipping 23 matching lines...) Expand all
90 } 95 }
91 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) 96 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD)
92 void VectorPlatformDeviceSkia::DrawToNativeContext( 97 void VectorPlatformDeviceSkia::DrawToNativeContext(
93 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { 98 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
94 // Should never be called on Linux. 99 // Should never be called on Linux.
95 SkASSERT(false); 100 SkASSERT(false);
96 } 101 }
97 #endif 102 #endif
98 103
99 } // namespace skia 104 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/vector_canvas_unittest.cc ('k') | ui/gfx/canvas_skia.cc » ('j') | ui/gfx/canvas_skia.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698