OLD | NEW |
1 // Copyright (c) 2008, Google Inc. All rights reserved. | 1 // Copyright (c) 2008, Google Inc. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following disclaimer | 10 // copyright notice, this list of conditions and the following disclaimer |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (s < 0) | 135 if (s < 0) |
136 return 0; | 136 return 0; |
137 | 137 |
138 int a = SkAlphaMul(SkColorGetA(c), s); | 138 int a = SkAlphaMul(SkColorGetA(c), s); |
139 return (c & 0x00FFFFFF) | (a << 24); | 139 return (c & 0x00FFFFFF) | (a << 24); |
140 } | 140 } |
141 | 141 |
142 // PlatformContextSkia --------------------------------------------------------- | 142 // PlatformContextSkia --------------------------------------------------------- |
143 | 143 |
144 // Danger: canvas can be NULL. | 144 // Danger: canvas can be NULL. |
145 PlatformContextSkia::PlatformContextSkia(gfx::PlatformCanvas* canvas) | 145 PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas) |
146 : m_canvas(canvas) | 146 : m_canvas(canvas) |
147 , m_stateStack(sizeof(State)) | 147 , m_stateStack(sizeof(State)) |
148 { | 148 { |
149 m_stateStack.append(State()); | 149 m_stateStack.append(State()); |
150 m_state = &m_stateStack.last(); | 150 m_state = &m_stateStack.last(); |
151 #if defined(OS_LINUX) | 151 #if defined(OS_LINUX) |
152 m_gdkskia = m_canvas ? gdk_skia_new(m_canvas) : NULL; | 152 m_gdkskia = m_canvas ? gdk_skia_new(m_canvas) : NULL; |
153 #endif | 153 #endif |
154 } | 154 } |
155 | 155 |
156 PlatformContextSkia::~PlatformContextSkia() | 156 PlatformContextSkia::~PlatformContextSkia() |
157 { | 157 { |
158 #if defined(OS_LINUX) | 158 #if defined(OS_LINUX) |
159 if (m_gdkskia) { | 159 if (m_gdkskia) { |
160 g_object_unref(m_gdkskia); | 160 g_object_unref(m_gdkskia); |
161 m_gdkskia = NULL; | 161 m_gdkskia = NULL; |
162 } | 162 } |
163 #endif | 163 #endif |
164 } | 164 } |
165 | 165 |
166 void PlatformContextSkia::setCanvas(gfx::PlatformCanvas* canvas) | 166 void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas) |
167 { | 167 { |
168 m_canvas = canvas; | 168 m_canvas = canvas; |
169 } | 169 } |
170 | 170 |
171 void PlatformContextSkia::save() | 171 void PlatformContextSkia::save() |
172 { | 172 { |
173 m_stateStack.append(*m_state); | 173 m_stateStack.append(*m_state); |
174 m_state = &m_stateStack.last(); | 174 m_state = &m_stateStack.last(); |
175 | 175 |
176 // Save our native canvas. | 176 // Save our native canvas. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 const SkBitmap* PlatformContextSkia::bitmap() const | 415 const SkBitmap* PlatformContextSkia::bitmap() const |
416 { | 416 { |
417 return &m_canvas->getDevice()->accessBitmap(false); | 417 return &m_canvas->getDevice()->accessBitmap(false); |
418 } | 418 } |
419 | 419 |
420 bool PlatformContextSkia::IsPrinting() | 420 bool PlatformContextSkia::IsPrinting() |
421 { | 421 { |
422 return m_canvas->getTopPlatformDevice().IsVectorial(); | 422 return m_canvas->getTopPlatformDevice().IsVectorial(); |
423 } | 423 } |
OLD | NEW |