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

Unified Diff: src/core/SkAutoPixmapStorage.cpp

Issue 1808833002: Revert of Add SkSpecialImage::extractSubset & NewFromPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/core/SkAutoPixmapStorage.h ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkAutoPixmapStorage.cpp
diff --git a/src/core/SkAutoPixmapStorage.cpp b/src/core/SkAutoPixmapStorage.cpp
deleted file mode 100644
index 3be28a94c428984a7a5665fed1e76f19890b855b..0000000000000000000000000000000000000000
--- a/src/core/SkAutoPixmapStorage.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkAutoPixmapStorage.h"
-#include "SkData.h"
-
-SkAutoPixmapStorage::SkAutoPixmapStorage() : fStorage(nullptr) {}
-
-SkAutoPixmapStorage::~SkAutoPixmapStorage() {
- this->freeStorage();
-}
-
-size_t SkAutoPixmapStorage::AllocSize(const SkImageInfo& info, size_t* rowBytes) {
- size_t rb = info.minRowBytes();
- if (rowBytes) {
- *rowBytes = rb;
- }
- return info.getSafeSize(rb);
-}
-
-bool SkAutoPixmapStorage::tryAlloc(const SkImageInfo& info) {
- this->freeStorage();
-
- size_t rb;
- size_t size = AllocSize(info, &rb);
- if (0 == size) {
- return false;
- }
- void* pixels = sk_malloc_flags(size, 0);
- if (nullptr == pixels) {
- return false;
- }
- this->reset(info, pixels, rb);
- fStorage = pixels;
- return true;
-}
-
-void SkAutoPixmapStorage::alloc(const SkImageInfo& info) {
- if (!this->tryAlloc(info)) {
- sk_throw();
- }
-}
-
-const SkData* SkAutoPixmapStorage::detachPixelsAsData() {
- if (!fStorage) {
- return nullptr;
- }
-
- auto data = SkData::MakeFromMalloc(fStorage, this->getSafeSize());
- fStorage = nullptr;
- this->INHERITED::reset();
-
- return data.release();
-}
-
-void SkAutoPixmapStorage::release() {
- fStorage = nullptr;
- this->INHERITED::reset();
-}
« no previous file with comments | « src/core/SkAutoPixmapStorage.h ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698