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

Side by Side Diff: src/effects/SkBitmapSource.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/effects/SkAvoidXfermode.cpp ('k') | src/effects/SkBlurDrawLooper.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 2012 The Android Open Source Project 2 * Copyright 2012 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 #include "SkBitmapSource.h" 8 #include "SkBitmapSource.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkValidationUtils.h" 13 #include "SkValidationUtils.h"
14 14
15 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap) 15 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap)
16 : INHERITED(0, 0) 16 : INHERITED(0, 0)
17 , fBitmap(bitmap) 17 , fBitmap(bitmap)
18 , fSrcRect(SkRect::MakeWH(SkIntToScalar(bitmap.width()), 18 , fSrcRect(SkRect::MakeWH(SkIntToScalar(bitmap.width()),
19 SkIntToScalar(bitmap.height()))) 19 SkIntToScalar(bitmap.height())))
20 , fDstRect(fSrcRect) 20 , fDstRect(fSrcRect)
21 {} 21 {}
22 22
23 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co nst SkRect& dstRect) 23 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co nst SkRect& dstRect)
24 : INHERITED(0, 0) 24 : INHERITED(0, 0)
25 , fBitmap(bitmap) 25 , fBitmap(bitmap)
26 , fSrcRect(srcRect) 26 , fSrcRect(srcRect)
27 , fDstRect(dstRect) {} 27 , fDstRect(dstRect) {}
28 28
29 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
30 SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) {
31 buffer.readBitmap(&fBitmap);
32 buffer.readRect(&fSrcRect);
33 buffer.readRect(&fDstRect);
34 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect (fDstRect));
35 }
36 #endif
37
29 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) { 38 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
30 SkRect src, dst; 39 SkRect src, dst;
31 buffer.readRect(&src); 40 buffer.readRect(&src);
32 buffer.readRect(&dst); 41 buffer.readRect(&dst);
33 SkBitmap bitmap; 42 SkBitmap bitmap;
34 if (!buffer.readBitmap(&bitmap)) { 43 if (!buffer.readBitmap(&bitmap)) {
35 return NULL; 44 return NULL;
36 } 45 }
37 return SkBitmapSource::Create(bitmap, src, dst); 46 return SkBitmapSource::Create(bitmap, src, dst);
38 } 47 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 85
77 *result = device.get()->accessBitmap(false); 86 *result = device.get()->accessBitmap(false);
78 offset->fX = dstIRect.fLeft; 87 offset->fX = dstIRect.fLeft;
79 offset->fY = dstIRect.fTop; 88 offset->fY = dstIRect.fTop;
80 return true; 89 return true;
81 } 90 }
82 91
83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { 92 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const {
84 *dst = fDstRect; 93 *dst = fDstRect;
85 } 94 }
OLDNEW
« no previous file with comments | « src/effects/SkAvoidXfermode.cpp ('k') | src/effects/SkBlurDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698