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

Side by Side Diff: bench/subset/SubsetZoomBench.cpp

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use aligned memory in swizzler test 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 | « bench/subset/SubsetTranslateBench.cpp ('k') | dm/DMSrcSink.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 "CodecBenchPriv.h" 8 #include "CodecBenchPriv.h"
9 #include "SubsetZoomBench.h" 9 #include "SubsetZoomBench.h"
10 #include "SubsetBenchPriv.h" 10 #include "SubsetBenchPriv.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const int subsetWidth = SkTMin(w, info.width() - subsetStartX); 81 const int subsetWidth = SkTMin(w, info.width() - subsetStartX);
82 const int subsetHeight = SkTMin(h, info.height() - subsetStartY) ; 82 const int subsetHeight = SkTMin(h, info.height() - subsetStartY) ;
83 // Note that if we subsetted and scaled in a single step, we cou ld use the 83 // Note that if we subsetted and scaled in a single step, we cou ld use the
84 // same bitmap - as is often done in actual use cases. 84 // same bitmap - as is often done in actual use cases.
85 SkBitmap bitmap; 85 SkBitmap bitmap;
86 SkImageInfo subsetInfo = info.makeWH(subsetWidth, subsetHeight); 86 SkImageInfo subsetInfo = info.makeWH(subsetWidth, subsetHeight);
87 alloc_pixels(&bitmap, subsetInfo, colors, colorCount); 87 alloc_pixels(&bitmap, subsetInfo, colors, colorCount);
88 88
89 uint32_t bpp = info.bytesPerPixel(); 89 uint32_t bpp = info.bytesPerPixel();
90 90
91 SkDEBUGCODE(result = ) codec->skipScanlines(subsetStartY); 91 SkDEBUGCODE(int lines = ) codec->skipScanlines(subsetStartY);
92 SkASSERT(SkCodec::kSuccess == result); 92 SkASSERT(subsetStartY == lines);
93 93
94 switch (codec->getScanlineOrder()) { 94 switch (codec->getScanlineOrder()) {
95 case SkCodec::kTopDown_SkScanlineOrder: 95 case SkCodec::kTopDown_SkScanlineOrder:
96 for (int y = 0; y < subsetHeight; y++) { 96 for (int y = 0; y < subsetHeight; y++) {
97 SkDEBUGCODE(result = ) codec->getScanlines(row.get() , 1, 0); 97 SkDEBUGCODE(lines = ) codec->getScanlines(row.get(), 1, 0);
98 SkASSERT(SkCodec::kSuccess == result); 98 SkASSERT(1 == lines);
99 99
100 memcpy(bitmap.getAddr(0, y), row.get() + subsetStart X * bpp, 100 memcpy(bitmap.getAddr(0, y), row.get() + subsetStart X * bpp,
101 subsetWidth * bpp); 101 subsetWidth * bpp);
102 } 102 }
103 break; 103 break;
104 case SkCodec::kNone_SkScanlineOrder: { 104 case SkCodec::kNone_SkScanlineOrder: {
105 // decode all scanlines that intersect the subset, and c opy the subset 105 // decode all scanlines that intersect the subset, and c opy the subset
106 // into the output. 106 // into the output.
107 SkImageInfo stripeInfo = info.makeWH(info.width(), subse tHeight); 107 SkImageInfo stripeInfo = info.makeWH(info.width(), subse tHeight);
108 SkBitmap stripeBm; 108 SkBitmap stripeBm;
109 alloc_pixels(&stripeBm, stripeInfo, colors, colorCount); 109 alloc_pixels(&stripeBm, stripeInfo, colors, colorCount);
110 110
111 SkDEBUGCODE(result = ) codec->getScanlines(stripeBm.getP ixels(), 111 SkDEBUGCODE(lines = ) codec->getScanlines(stripeBm.getPi xels(),
112 subsetHeight, stripeBm.rowBytes()); 112 subsetHeight, stripeBm.rowBytes());
113 SkASSERT(SkCodec::kSuccess == result); 113 SkASSERT(subsetHeight == lines);
114 114
115 for (int y = 0; y < subsetHeight; y++) { 115 for (int y = 0; y < subsetHeight; y++) {
116 memcpy(bitmap.getAddr(0, y), 116 memcpy(bitmap.getAddr(0, y),
117 stripeBm.getAddr(subsetStartX, y), 117 stripeBm.getAddr(subsetStartX, y),
118 subsetWidth * bpp); 118 subsetWidth * bpp);
119 } 119 }
120 break; 120 break;
121 } 121 }
122 default: 122 default:
123 // We currently are only testing kTopDown and kNone, whi ch are the only 123 // We currently are only testing kTopDown and kNone, whi ch are the only
(...skipping 23 matching lines...) Expand all
147 SkBitmap bitmap; 147 SkBitmap bitmap;
148 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub setWidth, 148 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub setWidth,
149 subsetHeight); 149 subsetHeight);
150 SkAssertResult(decoder->decodeSubset(&bitmap, rect, fColorType)) ; 150 SkAssertResult(decoder->decodeSubset(&bitmap, rect, fColorType)) ;
151 w <<= 1; 151 w <<= 1;
152 h <<= 1; 152 h <<= 1;
153 } while (w < 2 * width || h < 2 * height); 153 } while (w < 2 * width || h < 2 * height);
154 } 154 }
155 } 155 }
156 } 156 }
OLDNEW
« no previous file with comments | « bench/subset/SubsetTranslateBench.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698