OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/PaintRecordPattern.h" | 5 #include "platform/graphics/PaintRecordPattern.h" |
6 | 6 |
7 #include "platform/graphics/paint/PaintFlags.h" | 7 #include "platform/graphics/paint/PaintFlags.h" |
8 #include "platform/graphics/paint/PaintRecord.h" | 8 #include "platform/graphics/paint/PaintRecord.h" |
9 #include "platform/graphics/paint/PaintShader.h" | 9 #include "platform/graphics/paint/PaintShader.h" |
10 #include "platform/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 PassRefPtr<PaintRecordPattern> PaintRecordPattern::Create( | 14 PassRefPtr<PaintRecordPattern> PaintRecordPattern::Create( |
15 sk_sp<PaintRecord> record, | 15 sk_sp<PaintRecord> record, |
| 16 const FloatRect& record_bounds, |
16 RepeatMode repeat_mode) { | 17 RepeatMode repeat_mode) { |
17 return AdoptRef(new PaintRecordPattern(std::move(record), repeat_mode)); | 18 return AdoptRef( |
| 19 new PaintRecordPattern(std::move(record), record_bounds, repeat_mode)); |
18 } | 20 } |
19 | 21 |
20 PaintRecordPattern::PaintRecordPattern(sk_sp<PaintRecord> record, | 22 PaintRecordPattern::PaintRecordPattern(sk_sp<PaintRecord> record, |
| 23 const FloatRect& record_bounds, |
21 RepeatMode mode) | 24 RepeatMode mode) |
22 : Pattern(mode), tile_record_(std::move(record)) { | 25 : Pattern(mode), |
| 26 tile_record_(std::move(record)), |
| 27 tile_record_bounds_(record_bounds) { |
23 // All current clients use RepeatModeXY, so we only support this mode for now. | 28 // All current clients use RepeatModeXY, so we only support this mode for now. |
24 DCHECK(IsRepeatXY()); | 29 DCHECK(IsRepeatXY()); |
25 | 30 |
26 // FIXME: we don't have a good way to account for DL memory utilization. | 31 // FIXME: we don't have a good way to account for DL memory utilization. |
27 } | 32 } |
28 | 33 |
29 PaintRecordPattern::~PaintRecordPattern() {} | 34 PaintRecordPattern::~PaintRecordPattern() {} |
30 | 35 |
31 sk_sp<PaintShader> PaintRecordPattern::CreateShader( | 36 sk_sp<PaintShader> PaintRecordPattern::CreateShader( |
32 const SkMatrix& local_matrix) { | 37 const SkMatrix& local_matrix) { |
33 SkRect tile_bounds = tile_record_->cullRect(); | 38 return MakePaintShaderRecord(tile_record_, tile_record_bounds_, |
34 | 39 SkShader::kRepeat_TileMode, |
35 return MakePaintShaderRecord(tile_record_, SkShader::kRepeat_TileMode, | 40 SkShader::kRepeat_TileMode, &local_matrix); |
36 SkShader::kRepeat_TileMode, &local_matrix, | |
37 &tile_bounds); | |
38 } | 41 } |
39 | 42 |
40 } // namespace blink | 43 } // namespace blink |
OLD | NEW |