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

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

Issue 22796028: Updating Chromium to Skia SkBaseDevice/SkBitmapDevice split (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs Created 7 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "skia/ext/bitmap_platform_device_data.h" 6 #include "skia/ext/bitmap_platform_device_data.h"
7 #include "skia/ext/platform_canvas.h" 7 #include "skia/ext/platform_canvas.h"
8 8
9 #if defined(OS_OPENBSD) 9 #if defined(OS_OPENBSD)
10 #include <cairo.h> 10 #include <cairo.h>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 bool is_opaque, 126 bool is_opaque,
127 uint8_t* data) { 127 uint8_t* data) {
128 cairo_surface_t* surface = cairo_image_surface_create_for_data( 128 cairo_surface_t* surface = cairo_image_surface_create_for_data(
129 data, CAIRO_FORMAT_ARGB32, width, height, 129 data, CAIRO_FORMAT_ARGB32, width, height,
130 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width)); 130 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width));
131 131
132 return Create(width, height, is_opaque, surface); 132 return Create(width, height, is_opaque, surface);
133 } 133 }
134 134
135 // The device will own the bitmap, which corresponds to also owning the pixel 135 // The device will own the bitmap, which corresponds to also owning the pixel
136 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. 136 // data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap.
137 BitmapPlatformDevice::BitmapPlatformDevice( 137 BitmapPlatformDevice::BitmapPlatformDevice(
138 const SkBitmap& bitmap, 138 const SkBitmap& bitmap,
139 BitmapPlatformDeviceData* data) 139 BitmapPlatformDeviceData* data)
140 : SkDevice(bitmap), 140 : SkBitmapDevice(bitmap),
141 data_(data) { 141 data_(data) {
142 SetPlatformDevice(this, this); 142 SetPlatformDevice(this, this);
143 } 143 }
144 144
145 BitmapPlatformDevice::~BitmapPlatformDevice() { 145 BitmapPlatformDevice::~BitmapPlatformDevice() {
146 } 146 }
147 147
148 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 148 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
149 SkBitmap::Config config, int width, int height, bool isOpaque, 149 SkBitmap::Config config, int width, int height, bool isOpaque,
150 Usage /*usage*/) { 150 Usage /*usage*/) {
151 SkASSERT(config == SkBitmap::kARGB_8888_Config); 151 SkASSERT(config == SkBitmap::kARGB_8888_Config);
152 return BitmapPlatformDevice::Create(width, height, isOpaque); 152 return BitmapPlatformDevice::Create(width, height, isOpaque);
153 } 153 }
154 154
155 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { 155 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() {
156 data_->LoadConfig(); 156 data_->LoadConfig();
157 cairo_t* cairo = data_->bitmap_context(); 157 cairo_t* cairo = data_->bitmap_context();
158 cairo_surface_t* surface = cairo_get_target(cairo); 158 cairo_surface_t* surface = cairo_get_target(cairo);
(...skipping 14 matching lines...) Expand all
173 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 173 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
174 const SkRegion& region, 174 const SkRegion& region,
175 const SkClipStack&) { 175 const SkClipStack&) {
176 data_->SetMatrixClip(transform, region); 176 data_->SetMatrixClip(transform, region);
177 } 177 }
178 178
179 // PlatformCanvas impl 179 // PlatformCanvas impl
180 180
181 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, 181 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
182 uint8_t* data, OnFailureType failureType) { 182 uint8_t* data, OnFailureType failureType) {
183 skia::RefPtr<SkDevice> dev = skia::AdoptRef( 183 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
184 BitmapPlatformDevice::Create(width, height, is_opaque, data)); 184 BitmapPlatformDevice::Create(width, height, is_opaque, data));
185 return CreateCanvas(dev, failureType); 185 return CreateCanvas(dev, failureType);
186 } 186 }
187 187
188 // Port of PlatformBitmap to linux 188 // Port of PlatformBitmap to linux
189 PlatformBitmap::~PlatformBitmap() { 189 PlatformBitmap::~PlatformBitmap() {
190 cairo_destroy(surface_); 190 cairo_destroy(surface_);
191 } 191 }
192 192
193 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { 193 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) {
(...skipping 16 matching lines...) Expand all
210 cairo_surface_destroy(surf); 210 cairo_surface_destroy(surf);
211 return false; 211 return false;
212 } 212 }
213 213
214 surface_ = cairo_create(surf); 214 surface_ = cairo_create(surf);
215 cairo_surface_destroy(surf); 215 cairo_surface_destroy(surf);
216 return true; 216 return true;
217 } 217 }
218 218
219 } // namespace skia 219 } // 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