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

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

Issue 1576453002: fix opacity check in SkBitmapDevice::Create (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return nullptr; 88 return nullptr;
89 } 89 }
90 90
91 const SkImageInfo info = origInfo.makeAlphaType(newAT); 91 const SkImageInfo info = origInfo.makeAlphaType(newAT);
92 SkBitmap bitmap; 92 SkBitmap bitmap;
93 93
94 if (kUnknown_SkColorType == info.colorType()) { 94 if (kUnknown_SkColorType == info.colorType()) {
95 if (!bitmap.setInfo(info)) { 95 if (!bitmap.setInfo(info)) {
96 return nullptr; 96 return nullptr;
97 } 97 }
98 } else if (bitmap.info().isOpaque()) { 98 } else if (info.isOpaque()) {
99 // If this bitmap is opaque, we don't have any sensible default color, 99 // If this bitmap is opaque, we don't have any sensible default color,
100 // so we just return uninitialized pixels. 100 // so we just return uninitialized pixels.
101 if (!bitmap.tryAllocPixels(info)) { 101 if (!bitmap.tryAllocPixels(info)) {
102 return nullptr; 102 return nullptr;
103 } 103 }
104 } else { 104 } else {
105 // This bitmap has transparency, so we'll zero the pixels (to transparen t). 105 // This bitmap has transparency, so we'll zero the pixels (to transparen t).
106 // We use a ZeroedPRFactory as a faster alloc-then-eraseColor(SK_ColorTR ANSPARENT). 106 // We use a ZeroedPRFactory as a faster alloc-then-eraseColor(SK_ColorTR ANSPARENT).
107 SkMallocPixelRef::ZeroedPRFactory factory; 107 SkMallocPixelRef::ZeroedPRFactory factory;
108 if (!bitmap.tryAllocPixels(info, &factory, nullptr/*color table*/)) { 108 if (!bitmap.tryAllocPixels(info, &factory, nullptr/*color table*/)) {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 paint.getRasterizer() || 387 paint.getRasterizer() ||
388 paint.getPathEffect() || 388 paint.getPathEffect() ||
389 paint.isFakeBoldText() || 389 paint.isFakeBoldText() ||
390 paint.getStyle() != SkPaint::kFill_Style || 390 paint.getStyle() != SkPaint::kFill_Style ||
391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) 391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode))
392 { 392 {
393 return true; 393 return true;
394 } 394 }
395 return false; 395 return false;
396 } 396 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698