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

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

Issue 769953002: 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
38 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) { 29 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
39 SkRect src, dst; 30 SkRect src, dst;
40 buffer.readRect(&src); 31 buffer.readRect(&src);
41 buffer.readRect(&dst); 32 buffer.readRect(&dst);
42 SkBitmap bitmap; 33 SkBitmap bitmap;
43 if (!buffer.readBitmap(&bitmap)) { 34 if (!buffer.readBitmap(&bitmap)) {
44 return NULL; 35 return NULL;
45 } 36 }
46 return SkBitmapSource::Create(bitmap, src, dst); 37 return SkBitmapSource::Create(bitmap, src, dst);
47 } 38 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 76
86 *result = device.get()->accessBitmap(false); 77 *result = device.get()->accessBitmap(false);
87 offset->fX = dstIRect.fLeft; 78 offset->fX = dstIRect.fLeft;
88 offset->fY = dstIRect.fTop; 79 offset->fY = dstIRect.fTop;
89 return true; 80 return true;
90 } 81 }
91 82
92 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { 83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const {
93 *dst = fDstRect; 84 *dst = fDstRect;
94 } 85 }
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