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, | |
17 RepeatMode repeat_mode) { | 16 RepeatMode repeat_mode) { |
18 return AdoptRef( | 17 return AdoptRef(new PaintRecordPattern(std::move(record), repeat_mode)); |
19 new PaintRecordPattern(std::move(record), record_bounds, repeat_mode)); | |
20 } | 18 } |
21 | 19 |
22 PaintRecordPattern::PaintRecordPattern(sk_sp<PaintRecord> record, | 20 PaintRecordPattern::PaintRecordPattern(sk_sp<PaintRecord> record, |
23 const FloatRect& record_bounds, | |
24 RepeatMode mode) | 21 RepeatMode mode) |
25 : Pattern(mode), | 22 : Pattern(mode), tile_record_(std::move(record)) { |
26 tile_record_(std::move(record)), | |
27 tile_record_bounds_(record_bounds) { | |
28 // All current clients use RepeatModeXY, so we only support this mode for now. | 23 // All current clients use RepeatModeXY, so we only support this mode for now. |
29 DCHECK(IsRepeatXY()); | 24 DCHECK(IsRepeatXY()); |
30 | 25 |
31 // FIXME: we don't have a good way to account for DL memory utilization. | 26 // FIXME: we don't have a good way to account for DL memory utilization. |
32 } | 27 } |
33 | 28 |
34 PaintRecordPattern::~PaintRecordPattern() {} | 29 PaintRecordPattern::~PaintRecordPattern() {} |
35 | 30 |
36 sk_sp<PaintShader> PaintRecordPattern::CreateShader( | 31 sk_sp<PaintShader> PaintRecordPattern::CreateShader( |
37 const SkMatrix& local_matrix) { | 32 const SkMatrix& local_matrix) { |
38 return MakePaintShaderRecord(tile_record_, tile_record_bounds_, | 33 SkRect tile_bounds = tile_record_->cullRect(); |
39 SkShader::kRepeat_TileMode, | 34 |
40 SkShader::kRepeat_TileMode, &local_matrix); | 35 return MakePaintShaderRecord(tile_record_, SkShader::kRepeat_TileMode, |
| 36 SkShader::kRepeat_TileMode, &local_matrix, |
| 37 &tile_bounds); |
41 } | 38 } |
42 | 39 |
43 } // namespace blink | 40 } // namespace blink |
OLD | NEW |