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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 201973003: remove SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -- dead code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 tmp.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), 693 tmp.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(),
694 bounds.height()); 694 bounds.height());
695 if (this->readPixels(&tmp, bounds.fLeft, bounds.fTop)) { 695 if (this->readPixels(&tmp, bounds.fLeft, bounds.fTop)) {
696 bitmap->swap(tmp); 696 bitmap->swap(tmp);
697 return true; 697 return true;
698 } else { 698 } else {
699 return false; 699 return false;
700 } 700 }
701 } 701 }
702 702
703 #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
704 void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y,
705 Config8888 config8888) {
706 SkBaseDevice* device = this->getDevice();
707 if (device) {
708 if (SkIRect::Intersects(SkIRect::MakeSize(this->getDeviceSize()),
709 SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.h eight()))) {
710 device->accessBitmap(true);
711 device->writePixels(bitmap, x, y, config8888);
712 }
713 }
714 }
715 #endif
716
717 bool SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y) { 703 bool SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y) {
718 if (bitmap.getTexture()) { 704 if (bitmap.getTexture()) {
719 return false; 705 return false;
720 } 706 }
721 SkBitmap bm(bitmap); 707 SkBitmap bm(bitmap);
722 bm.lockPixels(); 708 bm.lockPixels();
723 if (bm.getPixels()) { 709 if (bm.getPixels()) {
724 return this->writePixels(bm.info(), bm.getPixels(), bm.rowBytes(), x, y) ; 710 return this->writePixels(bm.info(), bm.getPixels(), bm.rowBytes(), x, y) ;
725 } 711 }
726 return false; 712 return false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 if (x > 0) { 745 if (x > 0) {
760 x = 0; 746 x = 0;
761 } 747 }
762 if (y > 0) { 748 if (y > 0) {
763 y = 0; 749 y = 0;
764 } 750 }
765 // here x,y are either 0 or negative 751 // here x,y are either 0 or negative
766 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel()); 752 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel());
767 753
768 // The device can assert that the requested area is always contained in its bounds 754 // The device can assert that the requested area is always contained in its bounds
769 return device->writePixelsDirect(info, pixels, rowBytes, target.x(), target. y()); 755 return device->writePixels(info, pixels, rowBytes, target.x(), target.y());
770 } 756 }
771 757
772 SkCanvas* SkCanvas::canvasForDrawIter() { 758 SkCanvas* SkCanvas::canvasForDrawIter() {
773 return this; 759 return this;
774 } 760 }
775 761
776 ////////////////////////////////////////////////////////////////////////////// 762 //////////////////////////////////////////////////////////////////////////////
777 763
778 void SkCanvas::updateDeviceCMCache() { 764 void SkCanvas::updateDeviceCMCache() {
779 if (fDeviceCMDirty) { 765 if (fDeviceCMDirty) {
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2560 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2575 return NULL; 2561 return NULL;
2576 } 2562 }
2577 2563
2578 // should this functionality be moved into allocPixels()? 2564 // should this functionality be moved into allocPixels()?
2579 if (!bitmap.info().isOpaque()) { 2565 if (!bitmap.info().isOpaque()) {
2580 bitmap.eraseColor(0); 2566 bitmap.eraseColor(0);
2581 } 2567 }
2582 return SkNEW_ARGS(SkCanvas, (bitmap)); 2568 return SkNEW_ARGS(SkCanvas, (bitmap));
2583 } 2569 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698