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

Unified Diff: src/utils/SkBitmapRegionSampler.cpp

Issue 1322773004: Revert of Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/utils/SkBitmapRegionSampler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitmapRegionSampler.cpp
diff --git a/src/utils/SkBitmapRegionSampler.cpp b/src/utils/SkBitmapRegionSampler.cpp
deleted file mode 100644
index 98c183daac617d58c86c4b60ab50807cf155dc7c..0000000000000000000000000000000000000000
--- a/src/utils/SkBitmapRegionSampler.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBitmapRegionSampler.h"
-
-SkBitmapRegionSampler::SkBitmapRegionSampler(SkImageDecoder* decoder, int width,
- int height)
- : INHERITED(width, height)
- , fDecoder(decoder)
-{}
-
-/*
- * Three differences from the Android version:
- * Returns a Skia bitmap instead of an Android bitmap.
- * Android version attempts to reuse a recycled bitmap.
- * Removed the options object and used parameters for color type and
- * sample size.
- */
-SkBitmap* SkBitmapRegionSampler::decodeRegion(int start_x, int start_y,
- int width, int height,
- int sampleSize,
- SkColorType prefColorType) {
- // Match Android's default settings
- fDecoder->setDitherImage(true);
- fDecoder->setPreferQualityOverSpeed(false);
- fDecoder->setRequireUnpremultipliedColors(false);
- fDecoder->setSampleSize(sampleSize);
-
- // kAlpha8 is the legacy representation of kGray8 used by SkImageDecoder
- if (kGray_8_SkColorType == prefColorType) {
- prefColorType = kAlpha_8_SkColorType;
- }
-
- SkIRect region;
- region.fLeft = start_x;
- region.fTop = start_y;
- region.fRight = start_x + width;
- region.fBottom = start_y + height;
-
- SkAutoTDelete<SkBitmap> bitmap(new SkBitmap());
- if (!fDecoder->decodeSubset(bitmap.get(), region, prefColorType)) {
- SkDebugf("Error: decodeRegion failed.\n");
- return nullptr;
- }
- return bitmap.detach();
-}
« no previous file with comments | « src/utils/SkBitmapRegionSampler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698