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

Unified Diff: tools/SkBitmapRegionDecoderInterface.cpp

Issue 1415243007: Rename SkBitmapRegionDecoder and Create function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « tools/SkBitmapRegionDecoderInterface.h ('k') | tools/SkBitmapRegionSampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/SkBitmapRegionDecoderInterface.cpp
diff --git a/tools/SkBitmapRegionDecoderInterface.cpp b/tools/SkBitmapRegionDecoderInterface.cpp
deleted file mode 100644
index d009b27f3a3dd5cbc160a1a23906557878248de0..0000000000000000000000000000000000000000
--- a/tools/SkBitmapRegionDecoderInterface.cpp
+++ /dev/null
@@ -1,77 +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 "SkBitmapRegionCanvas.h"
-#include "SkBitmapRegionCodec.h"
-#include "SkBitmapRegionDecoderInterface.h"
-#include "SkBitmapRegionSampler.h"
-#include "SkAndroidCodec.h"
-#include "SkCodec.h"
-#include "SkCodecPriv.h"
-#include "SkImageDecoder.h"
-
-SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(
- SkData* data, Strategy strategy) {
- return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(new SkMemoryStream(data),
- strategy);
-}
-
-SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(
- SkStreamRewindable* stream, Strategy strategy) {
- SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
- switch (strategy) {
- case kOriginal_Strategy: {
- SkImageDecoder* decoder = SkImageDecoder::Factory(streamDeleter);
- int width, height;
- if (nullptr == decoder) {
- SkCodecPrintf("Error: Could not create image decoder.\n");
- return nullptr;
- }
- if (!decoder->buildTileIndex(streamDeleter.detach(), &width, &height)) {
- SkCodecPrintf("Error: Could not build tile index.\n");
- delete decoder;
- return nullptr;
- }
- return new SkBitmapRegionSampler(decoder, width, height);
- }
- case kCanvas_Strategy: {
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(streamDeleter.detach()));
- if (nullptr == codec) {
- SkCodecPrintf("Error: Failed to create decoder.\n");
- return nullptr;
- }
-
- if (SkEncodedFormat::kWEBP_SkEncodedFormat == codec->getEncodedFormat()) {
- // FIXME: Support webp using a special case. Webp does not support
- // scanline decoding.
- return nullptr;
- }
-
- switch (codec->getScanlineOrder()) {
- case SkCodec::kTopDown_SkScanlineOrder:
- case SkCodec::kNone_SkScanlineOrder:
- break;
- default:
- SkCodecPrintf("Error: Scanline ordering not supported.\n");
- return nullptr;
- }
- return new SkBitmapRegionCanvas(codec.detach());
- }
- case kAndroidCodec_Strategy: {
- SkAutoTDelete<SkAndroidCodec> codec =
- SkAndroidCodec::NewFromStream(streamDeleter.detach());
- if (NULL == codec) {
- SkCodecPrintf("Error: Failed to create codec.\n");
- return NULL;
- }
- return new SkBitmapRegionCodec(codec.detach());
- }
- default:
- SkASSERT(false);
- return nullptr;
- }
-}
« no previous file with comments | « tools/SkBitmapRegionDecoderInterface.h ('k') | tools/SkBitmapRegionSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698