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

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

Issue 7193040: Revert 91504 - Stop using deprecated factory API for SkDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 | « skia/ext/bitmap_platform_device_linux.h ('k') | skia/ext/bitmap_platform_device_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bitmap_platform_device_linux.h" 5 #include "skia/ext/bitmap_platform_device_linux.h"
6 6
7 #include "skia/ext/bitmap_platform_device_data.h" 7 #include "skia/ext/bitmap_platform_device_data.h"
8 8
9 #include <cairo/cairo.h> 9 #include <cairo/cairo.h>
10 10
(...skipping 19 matching lines...) Expand all
30 // TODO(brettw) support non-rect clips. 30 // TODO(brettw) support non-rect clips.
31 SkIRect bounding = clip.getBounds(); 31 SkIRect bounding = clip.getBounds();
32 cairo_rectangle(context, bounding.fLeft, bounding.fTop, 32 cairo_rectangle(context, bounding.fLeft, bounding.fTop,
33 bounding.fRight - bounding.fLeft, 33 bounding.fRight - bounding.fLeft,
34 bounding.fBottom - bounding.fTop); 34 bounding.fBottom - bounding.fTop);
35 cairo_clip(context); 35 cairo_clip(context);
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 SkDevice* BitmapPlatformDeviceFactory::newDevice(SkCanvas* ignored,
41 SkBitmap::Config config,
42 int width, int height,
43 bool isOpaque,
44 bool isForLayer) {
45 SkASSERT(config == SkBitmap::kARGB_8888_Config);
46 return BitmapPlatformDevice::Create(width, height, isOpaque);
47 }
48
40 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( 49 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData(
41 cairo_surface_t* surface) 50 cairo_surface_t* surface)
42 : surface_(surface), 51 : surface_(surface),
43 config_dirty_(true) { // Want to load the config next time. 52 config_dirty_(true) { // Want to load the config next time.
44 bitmap_context_ = cairo_create(surface); 53 bitmap_context_ = cairo_create(surface);
45 } 54 }
46 55
47 BitmapPlatformDevice::BitmapPlatformDeviceData::~BitmapPlatformDeviceData() { 56 BitmapPlatformDevice::BitmapPlatformDeviceData::~BitmapPlatformDeviceData() {
48 cairo_destroy(bitmap_context_); 57 cairo_destroy(bitmap_context_);
49 cairo_surface_destroy(surface_); 58 cairo_surface_destroy(surface_);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 BitmapPlatformDevice::BitmapPlatformDevice( 129 BitmapPlatformDevice::BitmapPlatformDevice(
121 const SkBitmap& bitmap, 130 const SkBitmap& bitmap,
122 BitmapPlatformDeviceData* data) 131 BitmapPlatformDeviceData* data)
123 : PlatformDevice(bitmap), 132 : PlatformDevice(bitmap),
124 data_(data) { 133 data_(data) {
125 } 134 }
126 135
127 BitmapPlatformDevice::~BitmapPlatformDevice() { 136 BitmapPlatformDevice::~BitmapPlatformDevice() {
128 } 137 }
129 138
130 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 139 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
131 SkBitmap::Config config, int width, int height, bool isOpaque, 140 return SkNEW(BitmapPlatformDeviceFactory);
132 Usage /*usage*/) {
133 SkASSERT(config == SkBitmap::kARGB_8888_Config);
134 return BitmapPlatformDevice::Create(width, height, isOpaque);
135 } 141 }
136 142
137 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { 143 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() {
138 data_->LoadConfig(); 144 data_->LoadConfig();
139 cairo_t* cairo = data_->bitmap_context(); 145 cairo_t* cairo = data_->bitmap_context();
140 cairo_surface_t* surface = cairo_get_target(cairo); 146 cairo_surface_t* surface = cairo_get_target(cairo);
141 // Tell cairo to flush anything it has pending. 147 // Tell cairo to flush anything it has pending.
142 cairo_surface_flush(surface); 148 cairo_surface_flush(surface);
143 // Tell Cairo that we (probably) modified (actually, will modify) its pixel 149 // Tell Cairo that we (probably) modified (actually, will modify) its pixel
144 // buffer directly. 150 // buffer directly.
145 cairo_surface_mark_dirty(surface); 151 cairo_surface_mark_dirty(surface);
146 return cairo; 152 return cairo;
147 } 153 }
148 154
149 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 155 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
150 const SkRegion& region, 156 const SkRegion& region,
151 const SkClipStack&) { 157 const SkClipStack&) {
152 data_->SetMatrixClip(transform, region); 158 data_->SetMatrixClip(transform, region);
153 } 159 }
154 160
155 } // namespace skia 161 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_linux.h ('k') | skia/ext/bitmap_platform_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698