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

Side by Side Diff: tools/SkBitmapRegionCanvas.cpp

Issue 1387183003: Remove superfluous error messages from nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@icoFormat
Patch Set: Created 5 years, 2 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 | tools/SkBitmapRegionDecoderInterface.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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmapRegionCanvas.h" 8 #include "SkBitmapRegionCanvas.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * Android version attempts to reuse a recycled bitmap. 49 * Android version attempts to reuse a recycled bitmap.
50 * Removed the options object and used parameters for color type and 50 * Removed the options object and used parameters for color type and
51 * sample size. 51 * sample size.
52 */ 52 */
53 SkBitmap* SkBitmapRegionCanvas::decodeRegion(int inputX, int inputY, 53 SkBitmap* SkBitmapRegionCanvas::decodeRegion(int inputX, int inputY,
54 int inputWidth, int inputHeight, 54 int inputWidth, int inputHeight,
55 int sampleSize, 55 int sampleSize,
56 SkColorType dstColorType) { 56 SkColorType dstColorType) {
57 // Reject color types not supported by this method 57 // Reject color types not supported by this method
58 if (kIndex_8_SkColorType == dstColorType || kGray_8_SkColorType == dstColorT ype) { 58 if (kIndex_8_SkColorType == dstColorType || kGray_8_SkColorType == dstColorT ype) {
59 SkDebugf("Error: Color type not supported.\n");
60 return nullptr; 59 return nullptr;
61 } 60 }
62 61
63 // The client may not necessarily request a region that is fully within 62 // The client may not necessarily request a region that is fully within
64 // the image. We may need to do some calculation to determine what part 63 // the image. We may need to do some calculation to determine what part
65 // of the image to decode. 64 // of the image to decode.
66 65
67 // The left offset of the portion of the image we want, where zero 66 // The left offset of the portion of the image we want, where zero
68 // indicates the left edge of the image. 67 // indicates the left edge of the image.
69 int imageSubsetX; 68 int imageSubsetX;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 SkAlphaType dstAlphaType = fDecoder->getInfo().alphaType(); 107 SkAlphaType dstAlphaType = fDecoder->getInfo().alphaType();
109 if (kUnpremul_SkAlphaType == dstAlphaType) { 108 if (kUnpremul_SkAlphaType == dstAlphaType) {
110 dstAlphaType = kPremul_SkAlphaType; 109 dstAlphaType = kPremul_SkAlphaType;
111 } 110 }
112 SkImageInfo decodeInfo = SkImageInfo::Make(this->width(), this->height(), 111 SkImageInfo decodeInfo = SkImageInfo::Make(this->width(), this->height(),
113 dstColorType, dstAlphaType); 112 dstColorType, dstAlphaType);
114 113
115 // Start the scanline decoder 114 // Start the scanline decoder
116 SkCodec::Result r = fDecoder->startScanlineDecode(decodeInfo); 115 SkCodec::Result r = fDecoder->startScanlineDecode(decodeInfo);
117 if (SkCodec::kSuccess != r) { 116 if (SkCodec::kSuccess != r) {
118 SkDebugf("Error: Could not start scanline decoder.\n");
119 return nullptr; 117 return nullptr;
120 } 118 }
121 119
122 // Allocate a bitmap for the unscaled decode 120 // Allocate a bitmap for the unscaled decode
123 SkBitmap tmp; 121 SkBitmap tmp;
124 SkImageInfo tmpInfo = decodeInfo.makeWH(this->width(), imageSubsetHeight); 122 SkImageInfo tmpInfo = decodeInfo.makeWH(this->width(), imageSubsetHeight);
125 if (!tmp.tryAllocPixels(tmpInfo)) { 123 if (!tmp.tryAllocPixels(tmpInfo)) {
126 SkDebugf("Error: Could not allocate pixels.\n"); 124 SkDebugf("Error: Could not allocate pixels.\n");
127 return nullptr; 125 return nullptr;
128 } 126 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 (SkScalar) get_scaled_dimension(imageSubsetWidth, sampleSize), 177 (SkScalar) get_scaled_dimension(imageSubsetWidth, sampleSize),
180 (SkScalar) get_scaled_dimension(imageSubsetHeight, sampleSize)); 178 (SkScalar) get_scaled_dimension(imageSubsetHeight, sampleSize));
181 SkPaint paint; 179 SkPaint paint;
182 // Overwrite the dst with the src pixels 180 // Overwrite the dst with the src pixels
183 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 181 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
184 // TODO (msarett): Test multiple filter qualities. kNone is the default. 182 // TODO (msarett): Test multiple filter qualities. kNone is the default.
185 canvas.drawBitmapRect(tmp, src, dst, &paint); 183 canvas.drawBitmapRect(tmp, src, dst, &paint);
186 184
187 return bitmap.detach(); 185 return bitmap.detach();
188 } 186 }
OLDNEW
« no previous file with comments | « no previous file | tools/SkBitmapRegionDecoderInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698