aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 16:35:37 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 16:35:37 +0000
commit4c1f091b6835a771dc86f5a784dce693de4f4555 (patch)
treeda9617fa51807098bb5827d52713e96d04e19889 /src/images
parent8f0ca06ef44f7b94da549fbb0c5fab27092c5116 (diff)
kill unused SkFlipPixelRef
Review URL: https://codereview.appspot.com/6949043 git-svn-id: http://skia.googlecode.com/svn/trunk@6781 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkFlipPixelRef.cpp125
-rw-r--r--src/images/SkImages.cpp2
2 files changed, 0 insertions, 127 deletions
diff --git a/src/images/SkFlipPixelRef.cpp b/src/images/SkFlipPixelRef.cpp
deleted file mode 100644
index 2e73ece5ac..0000000000
--- a/src/images/SkFlipPixelRef.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkFlipPixelRef.h"
-#include "SkFlattenableBuffers.h"
-#include "SkRegion.h"
-
-SkFlipPixelRef::SkFlipPixelRef(SkBitmap::Config config, int width, int height)
-: fFlipper(width, height) {
- fConfig = config;
- fSize = SkBitmap::ComputeSize(config, width, height);
- fStorage = sk_malloc_throw(fSize << 1);
- fPage0 = fStorage;
- fPage1 = (char*)fStorage + fSize;
-}
-
-SkFlipPixelRef::~SkFlipPixelRef() {
- sk_free(fStorage);
-}
-
-const SkRegion& SkFlipPixelRef::beginUpdate(SkBitmap* device) {
- void* writeAddr;
- const void* readAddr;
- this->getFrontBack(&readAddr, &writeAddr);
-
- device->setConfig(fConfig, fFlipper.width(), fFlipper.height());
- device->setPixels(writeAddr);
-
- SkRegion copyBits;
- const SkRegion& dirty = fFlipper.update(&copyBits);
-
- SkFlipPixelRef::CopyBitsFromAddr(*device, copyBits, readAddr);
- return dirty;
-}
-
-void SkFlipPixelRef::endUpdate() {
- this->swapPages();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void* SkFlipPixelRef::onLockPixels(SkColorTable** ct) {
- fMutex.acquire();
- *ct = NULL;
- return fPage0;
-}
-
-void SkFlipPixelRef::onUnlockPixels() {
- fMutex.release();
-}
-
-void SkFlipPixelRef::swapPages() {
- fMutex.acquire();
- SkTSwap<void*>(fPage0, fPage1);
- this->notifyPixelsChanged();
- fMutex.release();
-}
-
-void SkFlipPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
- // only need to write page0
- buffer.writeByteArray(fPage0, fSize);
-}
-
-SkFlipPixelRef::SkFlipPixelRef(SkFlattenableReadBuffer& buffer)
- : INHERITED(buffer, NULL) {
- fSize = buffer.getArrayCount();
- fStorage = sk_malloc_throw(fSize << 1);
- fPage0 = fStorage;
- fPage1 = (char*)fStorage + fSize;
- buffer.readByteArray(fPage0);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static void copyRect(const SkBitmap& dst, const SkIRect& rect,
- const void* srcAddr, int shift) {
- const size_t offset = rect.fTop * dst.rowBytes() + (rect.fLeft << shift);
- char* dstP = static_cast<char*>(dst.getPixels()) + offset;
- const char* srcP = static_cast<const char*>(srcAddr) + offset;
- const size_t rb = dst.rowBytes();
- const size_t bytes = rect.width() << shift;
-
- int height = rect.height();
- while (--height >= 0) {
- memcpy(dstP, srcP, bytes);
- dstP += rb;
- srcP += rb;
- }
-}
-
-static int getShift(SkBitmap::Config config) {
- switch (config) {
- case SkBitmap::kARGB_8888_Config:
- return 2;
- case SkBitmap::kRGB_565_Config:
- case SkBitmap::kARGB_4444_Config:
- return 1;
- case SkBitmap::kIndex8_Config:
- case SkBitmap::kA8_Config:
- return 0;
- default:
- return -1; // signal not supported
- }
-}
-
-void SkFlipPixelRef::CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip,
- const void* srcAddr) {
- const int shift = getShift(dst.config());
- if (shift < 0) {
- return;
- }
-
- const SkIRect bounds = {0, 0, dst.width(), dst.height()};
- SkRegion::Cliperator iter(clip, bounds);
-
- while (!iter.done()) {
- copyRect(dst, iter.rect(), srcAddr, shift);
- iter.next();
- }
-}
diff --git a/src/images/SkImages.cpp b/src/images/SkImages.cpp
index 28dfd7f615..0bcc33fa51 100644
--- a/src/images/SkImages.cpp
+++ b/src/images/SkImages.cpp
@@ -6,11 +6,9 @@
*/
#include "SkFlattenable.h"
-#include "SkFlipPixelRef.h"
#include "SkImageRef_GlobalPool.h"
#include "SkImages.h"
void SkImages::InitializeFlattenables() {
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkFlipPixelRef)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageRef_GlobalPool)
}