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

Side by Side Diff: src/codec/SkScaledCodec.cpp

Issue 1385703002: SkScaledCodec should implement onRewind() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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 | « include/codec/SkScaledCodec.h ('k') | tests/CodexTest.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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkScaledCodec.h" 9 #include "SkScaledCodec.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 26 matching lines...) Expand all
37 return NewFromStream(new SkMemoryStream(data)); 37 return NewFromStream(new SkMemoryStream(data));
38 } 38 }
39 39
40 SkScaledCodec::SkScaledCodec(SkCodec* codec) 40 SkScaledCodec::SkScaledCodec(SkCodec* codec)
41 : INHERITED(codec->getInfo(), nullptr) 41 : INHERITED(codec->getInfo(), nullptr)
42 , fCodec(codec) 42 , fCodec(codec)
43 {} 43 {}
44 44
45 SkScaledCodec::~SkScaledCodec() {} 45 SkScaledCodec::~SkScaledCodec() {}
46 46
47 bool SkScaledCodec::onRewind() {
48 return fCodec->onRewind();
49 }
50
47 static SkISize best_scaled_dimensions(const SkISize& origDims, const SkISize& na tiveDims, 51 static SkISize best_scaled_dimensions(const SkISize& origDims, const SkISize& na tiveDims,
48 const SkISize& scaledCodecDims, float desi redScale) { 52 const SkISize& scaledCodecDims, float desi redScale) {
49 if (nativeDims == scaledCodecDims) { 53 if (nativeDims == scaledCodecDims) {
50 // does not matter which to return if equal. Return here to skip below c alculations 54 // does not matter which to return if equal. Return here to skip below c alculations
51 return nativeDims; 55 return nativeDims;
52 } 56 }
53 float idealWidth = origDims.width() * desiredScale; 57 float idealWidth = origDims.width() * desiredScale;
54 float idealHeight = origDims.height() * desiredScale; 58 float idealHeight = origDims.height() * desiredScale;
55 59
56 // calculate difference between native dimensions and ideal dimensions 60 // calculate difference between native dimensions and ideal dimensions
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 storagePtr += sampleY * rowBytes; 296 storagePtr += sampleY * rowBytes;
293 dst = SkTAddOffset<void>(dst, rowBytes); 297 dst = SkTAddOffset<void>(dst, rowBytes);
294 } 298 }
295 return result; 299 return result;
296 } 300 }
297 default: 301 default:
298 SkASSERT(false); 302 SkASSERT(false);
299 return kUnimplemented; 303 return kUnimplemented;
300 } 304 }
301 } 305 }
OLDNEW
« no previous file with comments | « include/codec/SkScaledCodec.h ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698