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

Side by Side Diff: tools/SkBitmapRegionSampler.cpp

Issue 1395383002: SkBitmapRegionDecoder clean-up (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments 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 | « tools/SkBitmapRegionSampler.h ('k') | 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 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 "SkBitmapRegionSampler.h" 8 #include "SkBitmapRegionSampler.h"
9 #include "SkCodecPriv.h"
9 10
10 SkBitmapRegionSampler::SkBitmapRegionSampler(SkImageDecoder* decoder, int width, 11 SkBitmapRegionSampler::SkBitmapRegionSampler(SkImageDecoder* decoder, int width,
11 int height) 12 int height)
12 : INHERITED(width, height) 13 : INHERITED(width, height)
13 , fDecoder(decoder) 14 , fDecoder(decoder)
14 {} 15 {}
15 16
16 /* 17 /*
17 * Three differences from the Android version: 18 * Three differences from the Android version:
18 * Returns a Skia bitmap instead of an Android bitmap. 19 * Returns a Skia bitmap instead of an Android bitmap.
(...skipping 17 matching lines...) Expand all
36 } 37 }
37 38
38 SkIRect region; 39 SkIRect region;
39 region.fLeft = start_x; 40 region.fLeft = start_x;
40 region.fTop = start_y; 41 region.fTop = start_y;
41 region.fRight = start_x + width; 42 region.fRight = start_x + width;
42 region.fBottom = start_y + height; 43 region.fBottom = start_y + height;
43 44
44 SkAutoTDelete<SkBitmap> bitmap(new SkBitmap()); 45 SkAutoTDelete<SkBitmap> bitmap(new SkBitmap());
45 if (!fDecoder->decodeSubset(bitmap.get(), region, prefColorType)) { 46 if (!fDecoder->decodeSubset(bitmap.get(), region, prefColorType)) {
46 SkDebugf("Error: decodeRegion failed.\n"); 47 SkCodecPrintf("Error: decodeRegion failed.\n");
47 return nullptr; 48 return nullptr;
48 } 49 }
49 return bitmap.detach(); 50 return bitmap.detach();
50 } 51 }
OLDNEW
« no previous file with comments | « tools/SkBitmapRegionSampler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698