OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
4 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
5 * Copyright (C) 2013 Google, Inc. All rights reserved. | 5 * Copyright (C) 2013 Google, Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 kRepeatModeY = 1 << 1, | 52 kRepeatModeY = 1 << 1, |
53 | 53 |
54 kRepeatModeNone = 0, | 54 kRepeatModeNone = 0, |
55 kRepeatModeXY = kRepeatModeX | kRepeatModeY | 55 kRepeatModeXY = kRepeatModeX | kRepeatModeY |
56 }; | 56 }; |
57 | 57 |
58 static PassRefPtr<Pattern> CreateImagePattern(PassRefPtr<Image>, | 58 static PassRefPtr<Pattern> CreateImagePattern(PassRefPtr<Image>, |
59 RepeatMode = kRepeatModeXY); | 59 RepeatMode = kRepeatModeXY); |
60 static PassRefPtr<Pattern> CreatePaintRecordPattern( | 60 static PassRefPtr<Pattern> CreatePaintRecordPattern( |
61 sk_sp<PaintRecord>, | 61 sk_sp<PaintRecord>, |
62 const FloatRect& record_bounds, | |
63 RepeatMode = kRepeatModeXY); | 62 RepeatMode = kRepeatModeXY); |
64 virtual ~Pattern(); | 63 virtual ~Pattern(); |
65 | 64 |
66 void ApplyToFlags(PaintFlags&, const SkMatrix&); | 65 void ApplyToFlags(PaintFlags&, const SkMatrix&); |
67 | 66 |
68 bool IsRepeatX() const { return repeat_mode_ & kRepeatModeX; } | 67 bool IsRepeatX() const { return repeat_mode_ & kRepeatModeX; } |
69 bool IsRepeatY() const { return repeat_mode_ & kRepeatModeY; } | 68 bool IsRepeatY() const { return repeat_mode_ & kRepeatModeY; } |
70 bool IsRepeatXY() const { return repeat_mode_ == kRepeatModeXY; } | 69 bool IsRepeatXY() const { return repeat_mode_ == kRepeatModeXY; } |
71 | 70 |
72 virtual bool IsTextureBacked() const { return false; } | 71 virtual bool IsTextureBacked() const { return false; } |
73 | 72 |
74 protected: | 73 protected: |
75 virtual sk_sp<PaintShader> CreateShader(const SkMatrix&) = 0; | 74 virtual sk_sp<PaintShader> CreateShader(const SkMatrix&) = 0; |
76 virtual bool IsLocalMatrixChanged(const SkMatrix&) const; | 75 virtual bool IsLocalMatrixChanged(const SkMatrix&) const; |
77 | 76 |
78 RepeatMode repeat_mode_; | 77 RepeatMode repeat_mode_; |
79 | 78 |
80 Pattern(RepeatMode); | 79 Pattern(RepeatMode); |
81 mutable sk_sp<PaintShader> cached_shader_; | 80 mutable sk_sp<PaintShader> cached_shader_; |
82 }; | 81 }; |
83 | 82 |
84 } // namespace blink | 83 } // namespace blink |
85 | 84 |
86 #endif | 85 #endif |
OLD | NEW |