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

Unified Diff: src/codec/SkCodec_libico.cpp

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Fix ico, sampling Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/codec/SkCodec_libico.cpp
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
index 798169d82b344902571d996d34c127818b3576e7..2d0e62eea68fadcb3a6ce272079804c88dfd31e8 100644
--- a/src/codec/SkCodec_libico.cpp
+++ b/src/codec/SkCodec_libico.cpp
@@ -206,10 +206,6 @@ SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const {
// We set the dimensions to the largest candidate image by default.
// Regardless of the scale request, this is the largest image that we
// will decode.
- if (desiredScale >= 1.0) {
- return this->getInfo().dimensions();
- }
-
int origWidth = this->getInfo().width();
int origHeight = this->getInfo().height();
float desiredSize = desiredScale * origWidth * origHeight;
@@ -230,6 +226,16 @@ SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const {
return fEmbeddedCodecs->operator[](minIndex)->getInfo().dimensions();
}
+bool SkIcoCodec::onDimensionsSupported(const SkISize& dim) {
msarett 2015/10/01 19:34:33 This is a bit redundant which I think is unfortuna
scroggo 2015/10/01 21:16:57 Agreed. Added a fixme.
+ for (int32_t i = 0; i < fEmbeddedCodecs->count(); i++) {
+ if (fEmbeddedCodecs->operator[](i)->getInfo().dimensions() == dim) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
/*
* Initiates the Ico decode
*/

Powered by Google App Engine
This is Rietveld 408576698