OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 , m_bufferClearNeeded(false) | 142 , m_bufferClearNeeded(false) |
143 , m_multisampleMode(None) | 143 , m_multisampleMode(None) |
144 , m_internalColorFormat(0) | 144 , m_internalColorFormat(0) |
145 , m_colorFormat(0) | 145 , m_colorFormat(0) |
146 , m_internalRenderbufferFormat(0) | 146 , m_internalRenderbufferFormat(0) |
147 , m_maxTextureSize(0) | 147 , m_maxTextureSize(0) |
148 , m_sampleCount(0) | 148 , m_sampleCount(0) |
149 , m_packAlignment(4) | 149 , m_packAlignment(4) |
150 , m_destructionInProgress(false) | 150 , m_destructionInProgress(false) |
151 , m_isHidden(false) | 151 , m_isHidden(false) |
152 , m_filterLevel(SkPaint::kLow_FilterLevel) | 152 , m_filterQuality(kLow_SkFilterQuality) |
153 { | 153 { |
154 // Used by browser tests to detect the use of a DrawingBuffer. | 154 // Used by browser tests to detect the use of a DrawingBuffer. |
155 TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation"); | 155 TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation"); |
156 #ifndef NDEBUG | 156 #ifndef NDEBUG |
157 drawingBufferCounter.increment(); | 157 drawingBufferCounter.increment(); |
158 #endif | 158 #endif |
159 } | 159 } |
160 | 160 |
161 DrawingBuffer::~DrawingBuffer() | 161 DrawingBuffer::~DrawingBuffer() |
162 { | 162 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 void DrawingBuffer::setIsHidden(bool hidden) | 197 void DrawingBuffer::setIsHidden(bool hidden) |
198 { | 198 { |
199 if (m_isHidden == hidden) | 199 if (m_isHidden == hidden) |
200 return; | 200 return; |
201 m_isHidden = hidden; | 201 m_isHidden = hidden; |
202 if (m_isHidden) | 202 if (m_isHidden) |
203 freeRecycledMailboxes(); | 203 freeRecycledMailboxes(); |
204 } | 204 } |
205 | 205 |
206 void DrawingBuffer::setFilterLevel(SkPaint::FilterLevel filterLevel) | 206 void DrawingBuffer::setFilterQuality(SkFilterQuality filterQuality) |
207 { | 207 { |
208 if (m_filterLevel != filterLevel) { | 208 if (m_filterQuality != filterQuality) { |
209 m_filterLevel = filterLevel; | 209 m_filterQuality = filterQuality; |
210 if (m_layer) | 210 if (m_layer) |
211 m_layer->setNearestNeighbor(filterLevel == SkPaint::kNone_FilterLeve
l); | 211 m_layer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 void DrawingBuffer::freeRecycledMailboxes() | 215 void DrawingBuffer::freeRecycledMailboxes() |
216 { | 216 { |
217 if (m_recycledMailboxQueue.isEmpty()) | 217 if (m_recycledMailboxQueue.isEmpty()) |
218 return; | 218 return; |
219 while (!m_recycledMailboxQueue.isEmpty()) | 219 while (!m_recycledMailboxQueue.isEmpty()) |
220 deleteMailbox(m_recycledMailboxQueue.takeLast()); | 220 deleteMailbox(m_recycledMailboxQueue.takeLast()); |
221 } | 221 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 518 } |
519 | 519 |
520 WebLayer* DrawingBuffer::platformLayer() | 520 WebLayer* DrawingBuffer::platformLayer() |
521 { | 521 { |
522 if (!m_layer) { | 522 if (!m_layer) { |
523 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExter
nalTextureLayer(this)); | 523 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExter
nalTextureLayer(this)); |
524 | 524 |
525 m_layer->setOpaque(!m_actualAttributes.alpha); | 525 m_layer->setOpaque(!m_actualAttributes.alpha); |
526 m_layer->setBlendBackgroundColor(m_actualAttributes.alpha); | 526 m_layer->setBlendBackgroundColor(m_actualAttributes.alpha); |
527 m_layer->setPremultipliedAlpha(m_actualAttributes.premultipliedAlpha); | 527 m_layer->setPremultipliedAlpha(m_actualAttributes.premultipliedAlpha); |
528 m_layer->setNearestNeighbor(m_filterLevel == SkPaint::kNone_FilterLevel)
; | 528 m_layer->setNearestNeighbor(m_filterQuality == kNone_SkFilterQuality); |
529 GraphicsLayer::registerContentsLayer(m_layer->layer()); | 529 GraphicsLayer::registerContentsLayer(m_layer->layer()); |
530 } | 530 } |
531 | 531 |
532 return m_layer->layer(); | 532 return m_layer->layer(); |
533 } | 533 } |
534 | 534 |
535 void DrawingBuffer::clearPlatformLayer() | 535 void DrawingBuffer::clearPlatformLayer() |
536 { | 536 { |
537 if (m_layer) | 537 if (m_layer) |
538 m_layer->clearTexture(); | 538 m_layer->clearTexture(); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 981 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
982 { | 982 { |
983 if (info->imageId) { | 983 if (info->imageId) { |
984 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 984 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
985 m_context->destroyImageCHROMIUM(info->imageId); | 985 m_context->destroyImageCHROMIUM(info->imageId); |
986 info->imageId = 0; | 986 info->imageId = 0; |
987 } | 987 } |
988 } | 988 } |
989 | 989 |
990 } // namespace blink | 990 } // namespace blink |
OLD | NEW |