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

Side by Side Diff: src/core/SkBitmapDevice.cpp

Issue 123223007: Revert "Revert "Revert "Revert of https://codereview.chromium.org/110593003/""" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix compatibility mode for onLockPixels by pre-nulling colortable Created 6 years, 11 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 | « include/images/SkImageRef.h ('k') | src/core/SkMallocPixelRef.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
11 #include "SkRasterClip.h" 11 #include "SkRasterClip.h"
12 #include "SkShader.h" 12 #include "SkShader.h"
13 13
14 #define CHECK_FOR_ANNOTATION(paint) \ 14 #define CHECK_FOR_ANNOTATION(paint) \
15 do { if (paint.getAnnotation()) { return; } } while (0) 15 do { if (paint.getAnnotation()) { return; } } while (0)
16 16
17 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) 17 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
18 : fBitmap(bitmap) { 18 : fBitmap(bitmap) {
19 SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config()); 19 SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config());
20 } 20 }
21 21
22 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties) 22 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
23 : SkBaseDevice(deviceProperties) 23 : SkBaseDevice(deviceProperties)
24 , fBitmap(bitmap) { 24 , fBitmap(bitmap) {
25 } 25 }
26 26
27 void SkBitmapDevice::init(SkBitmap::Config config, int width, int height, bool i sOpaque) { 27 void SkBitmapDevice::init(SkBitmap::Config config, int width, int height, bool i sOpaque) {
28 fBitmap.setConfig(config, width, height, 0, isOpaque ? 28 fBitmap.setConfig(config, width, height, 0, isOpaque ?
29 kOpaque_SkAlphaType : kPremul_SkAlphaType); 29 kOpaque_SkAlphaType : kPremul_SkAlphaType);
30 30
31 if (SkBitmap::kNo_Config != config) { 31 if (SkBitmap::kNo_Config != config) {
32 if (!fBitmap.allocPixels()) { 32 if (!fBitmap.allocPixels()) {
33 // indicate failure by zeroing our bitmap 33 // indicate failure by zeroing our bitmap
34 fBitmap.setConfig(config, 0, 0, 0, isOpaque ? 34 fBitmap.setConfig(config, 0, 0, 0, isOpaque ?
35 kOpaque_SkAlphaType : kPremul_SkAlphaType); 35 kOpaque_SkAlphaType : kPremul_SkAlphaType);
36 } else if (!isOpaque) { 36 } else if (!isOpaque) {
37 fBitmap.eraseColor(SK_ColorTRANSPARENT); 37 fBitmap.eraseColor(SK_ColorTRANSPARENT);
38 } 38 }
39 } 39 }
40 } 40 }
41 41
42 SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b ool isOpaque) { 42 SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b ool isOpaque) {
43 this->init(config, width, height, isOpaque); 43 this->init(config, width, height, isOpaque);
44 } 44 }
45 45
46 SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b ool isOpaque, 46 SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b ool isOpaque,
47 const SkDeviceProperties& deviceProperties) 47 const SkDeviceProperties& deviceProperties)
48 : SkBaseDevice(deviceProperties) 48 : SkBaseDevice(deviceProperties)
49 { 49 {
50 this->init(config, width, height, isOpaque); 50 this->init(config, width, height, isOpaque);
51 } 51 }
52 52
53 SkBitmapDevice::~SkBitmapDevice() { 53 SkBitmapDevice::~SkBitmapDevice() {
54 } 54 }
55 55
56 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { 56 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
57 SkASSERT(bm.width() == fBitmap.width()); 57 SkASSERT(bm.width() == fBitmap.width());
58 SkASSERT(bm.height() == fBitmap.height()); 58 SkASSERT(bm.height() == fBitmap.height());
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 paint.getStyle() != SkPaint::kFill_Style || 398 paint.getStyle() != SkPaint::kFill_Style ||
399 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { 399 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) {
400 // turn off lcd 400 // turn off lcd
401 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; 401 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
402 flags->fHinting = paint.getHinting(); 402 flags->fHinting = paint.getHinting();
403 return true; 403 return true;
404 } 404 }
405 // we're cool with the paint as is 405 // we're cool with the paint as is
406 return false; 406 return false;
407 } 407 }
OLDNEW
« no previous file with comments | « include/images/SkImageRef.h ('k') | src/core/SkMallocPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698