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

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

Issue 536003002: Hide fields in SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix qt Created 6 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 unified diff | Download patch
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkMallocPixelRef.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 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 if (!device) { 624 if (!device) {
625 return false; 625 return false;
626 } 626 }
627 627
628 const SkISize size = this->getBaseLayerSize(); 628 const SkISize size = this->getBaseLayerSize();
629 SkIRect srcR = SkIRect::MakeXYWH(x, y, origInfo.width(), origInfo.height()); 629 SkIRect srcR = SkIRect::MakeXYWH(x, y, origInfo.width(), origInfo.height());
630 if (!srcR.intersect(0, 0, size.width(), size.height())) { 630 if (!srcR.intersect(0, 0, size.width(), size.height())) {
631 return false; 631 return false;
632 } 632 }
633 633
634 SkImageInfo info = origInfo;
635 // the intersect may have shrunk info's logical size 634 // the intersect may have shrunk info's logical size
636 info.fWidth = srcR.width(); 635 const SkImageInfo info = origInfo.makeWH(srcR.width(), srcR.height());
637 info.fHeight = srcR.height();
638 636
639 // if x or y are negative, then we have to adjust pixels 637 // if x or y are negative, then we have to adjust pixels
640 if (x > 0) { 638 if (x > 0) {
641 x = 0; 639 x = 0;
642 } 640 }
643 if (y > 0) { 641 if (y > 0) {
644 y = 0; 642 y = 0;
645 } 643 }
646 // here x,y are either 0 or negative 644 // here x,y are either 0 or negative
647 dstP = ((char*)dstP - y * rowBytes - x * info.bytesPerPixel()); 645 dstP = ((char*)dstP - y * rowBytes - x * info.bytesPerPixel());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 SkIRect target = SkIRect::MakeXYWH(x, y, origInfo.width(), origInfo.height() ); 677 SkIRect target = SkIRect::MakeXYWH(x, y, origInfo.width(), origInfo.height() );
680 if (!target.intersect(0, 0, size.width(), size.height())) { 678 if (!target.intersect(0, 0, size.width(), size.height())) {
681 return false; 679 return false;
682 } 680 }
683 681
684 SkBaseDevice* device = this->getDevice(); 682 SkBaseDevice* device = this->getDevice();
685 if (!device) { 683 if (!device) {
686 return false; 684 return false;
687 } 685 }
688 686
689 SkImageInfo info = origInfo;
690 // the intersect may have shrunk info's logical size 687 // the intersect may have shrunk info's logical size
691 info.fWidth = target.width(); 688 const SkImageInfo info = origInfo.makeWH(target.width(), target.height());
692 info.fHeight = target.height();
693 689
694 // if x or y are negative, then we have to adjust pixels 690 // if x or y are negative, then we have to adjust pixels
695 if (x > 0) { 691 if (x > 0) {
696 x = 0; 692 x = 0;
697 } 693 }
698 if (y > 0) { 694 if (y > 0) {
699 y = 0; 695 y = 0;
700 } 696 }
701 // here x,y are either 0 or negative 697 // here x,y are either 0 or negative
702 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel()); 698 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel());
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 } 2572 }
2577 2573
2578 if (NULL != matrix) { 2574 if (NULL != matrix) {
2579 canvas->concat(*matrix); 2575 canvas->concat(*matrix);
2580 } 2576 }
2581 } 2577 }
2582 2578
2583 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2579 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2584 fCanvas->restoreToCount(fSaveCount); 2580 fCanvas->restoreToCount(fSaveCount);
2585 } 2581 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkMallocPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698