| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 ScopedStateRestorer scopedStateRestorer(this); | 244 ScopedStateRestorer scopedStateRestorer(this); |
| 245 bool forceGpuResult = false; | 245 bool forceGpuResult = false; |
| 246 return prepareTextureMailboxInternal(outMailbox, outReleaseCallback, | 246 return prepareTextureMailboxInternal(outMailbox, outReleaseCallback, |
| 247 forceGpuResult); | 247 forceGpuResult); |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool DrawingBuffer::prepareTextureMailboxInternal( | 250 bool DrawingBuffer::prepareTextureMailboxInternal( |
| 251 cc::TextureMailbox* outMailbox, | 251 cc::TextureMailbox* outMailbox, |
| 252 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback, | 252 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback, |
| 253 bool forceGpuResult) { | 253 bool forceGpuResult) { |
| 254 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 255 CHECK(m_stateRestorer); |
| 254 if (m_destructionInProgress) { | 256 if (m_destructionInProgress) { |
| 255 // It can be hit in the following sequence. | 257 // It can be hit in the following sequence. |
| 256 // 1. WebGL draws something. | 258 // 1. WebGL draws something. |
| 257 // 2. The compositor begins the frame. | 259 // 2. The compositor begins the frame. |
| 258 // 3. Javascript makes a context lost using WEBGL_lose_context extension. | 260 // 3. Javascript makes a context lost using WEBGL_lose_context extension. |
| 259 // 4. Here. | 261 // 4. Here. |
| 260 return false; | 262 return false; |
| 261 } | 263 } |
| 262 ASSERT(!m_isHidden); | 264 ASSERT(!m_isHidden); |
| 263 if (!m_contentsChanged) | 265 if (!m_contentsChanged) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 RefPtr<DrawingBuffer>(this), | 315 RefPtr<DrawingBuffer>(this), |
| 314 WTF::passed(std::move(bitmap)), m_size); | 316 WTF::passed(std::move(bitmap)), m_size); |
| 315 *outReleaseCallback = | 317 *outReleaseCallback = |
| 316 cc::SingleReleaseCallback::Create(convertToBaseCallback(std::move(func))); | 318 cc::SingleReleaseCallback::Create(convertToBaseCallback(std::move(func))); |
| 317 return true; | 319 return true; |
| 318 } | 320 } |
| 319 | 321 |
| 320 bool DrawingBuffer::finishPrepareTextureMailboxGpu( | 322 bool DrawingBuffer::finishPrepareTextureMailboxGpu( |
| 321 cc::TextureMailbox* outMailbox, | 323 cc::TextureMailbox* outMailbox, |
| 322 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) { | 324 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) { |
| 325 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 326 CHECK(m_stateRestorer); |
| 323 if (m_webGLVersion > WebGL1) { | 327 if (m_webGLVersion > WebGL1) { |
| 324 m_stateRestorer->setPixelUnpackBufferBindingDirty(); | 328 m_stateRestorer->setPixelUnpackBufferBindingDirty(); |
| 325 m_gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); | 329 m_gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| 326 } | 330 } |
| 327 | 331 |
| 328 // Specify the buffer that we will put in the mailbox. | 332 // Specify the buffer that we will put in the mailbox. |
| 329 RefPtr<ColorBuffer> colorBufferForMailbox; | 333 RefPtr<ColorBuffer> colorBufferForMailbox; |
| 330 if (m_preserveDrawingBuffer == Discard) { | 334 if (m_preserveDrawingBuffer == Discard) { |
| 331 // If we can discard the backbuffer, send the old backbuffer directly | 335 // If we can discard the backbuffer, send the old backbuffer directly |
| 332 // into the mailbox, and allocate (or recycle) a new backbuffer. | 336 // into the mailbox, and allocate (or recycle) a new backbuffer. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 defaultBufferRequiresAlphaChannelToBePreserved() ? GL_RGBA : GL_RGB; | 564 defaultBufferRequiresAlphaChannelToBePreserved() ? GL_RGBA : GL_RGB; |
| 561 parameters.creationInternalColorFormat = format; | 565 parameters.creationInternalColorFormat = format; |
| 562 parameters.internalColorFormat = format; | 566 parameters.internalColorFormat = format; |
| 563 parameters.colorFormat = format; | 567 parameters.colorFormat = format; |
| 564 } | 568 } |
| 565 return parameters; | 569 return parameters; |
| 566 } | 570 } |
| 567 | 571 |
| 568 PassRefPtr<DrawingBuffer::ColorBuffer> | 572 PassRefPtr<DrawingBuffer::ColorBuffer> |
| 569 DrawingBuffer::createOrRecycleColorBuffer() { | 573 DrawingBuffer::createOrRecycleColorBuffer() { |
| 574 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 575 CHECK(m_stateRestorer); |
| 570 if (!m_recycledColorBufferQueue.isEmpty()) { | 576 if (!m_recycledColorBufferQueue.isEmpty()) { |
| 571 RefPtr<ColorBuffer> recycled = m_recycledColorBufferQueue.takeLast(); | 577 RefPtr<ColorBuffer> recycled = m_recycledColorBufferQueue.takeLast(); |
| 572 if (recycled->receiveSyncToken.HasData()) | 578 if (recycled->receiveSyncToken.HasData()) |
| 573 m_gl->WaitSyncTokenCHROMIUM(recycled->receiveSyncToken.GetData()); | 579 m_gl->WaitSyncTokenCHROMIUM(recycled->receiveSyncToken.GetData()); |
| 574 DCHECK(recycled->size == m_size); | 580 DCHECK(recycled->size == m_size); |
| 575 return recycled; | 581 return recycled; |
| 576 } | 582 } |
| 577 return createColorBuffer(m_size); | 583 return createColorBuffer(m_size); |
| 578 } | 584 } |
| 579 | 585 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 m_multisampleFBO = 0; | 801 m_multisampleFBO = 0; |
| 796 m_fbo = 0; | 802 m_fbo = 0; |
| 797 | 803 |
| 798 if (m_layer) | 804 if (m_layer) |
| 799 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); | 805 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); |
| 800 | 806 |
| 801 m_client = nullptr; | 807 m_client = nullptr; |
| 802 } | 808 } |
| 803 | 809 |
| 804 bool DrawingBuffer::resizeDefaultFramebuffer(const IntSize& size) { | 810 bool DrawingBuffer::resizeDefaultFramebuffer(const IntSize& size) { |
| 811 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 812 CHECK(m_stateRestorer); |
| 805 // Recreate m_backColorBuffer. | 813 // Recreate m_backColorBuffer. |
| 806 m_backColorBuffer = createColorBuffer(size); | 814 m_backColorBuffer = createColorBuffer(size); |
| 807 | 815 |
| 808 attachColorBufferToReadFramebuffer(); | 816 attachColorBufferToReadFramebuffer(); |
| 809 | 817 |
| 810 if (wantExplicitResolve()) { | 818 if (wantExplicitResolve()) { |
| 811 m_stateRestorer->setFramebufferBindingDirty(); | 819 m_stateRestorer->setFramebufferBindingDirty(); |
| 812 m_stateRestorer->setRenderbufferBindingDirty(); | 820 m_stateRestorer->setRenderbufferBindingDirty(); |
| 813 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); | 821 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); |
| 814 m_gl->BindRenderbuffer(GL_RENDERBUFFER, m_multisampleRenderbuffer); | 822 m_gl->BindRenderbuffer(GL_RENDERBUFFER, m_multisampleRenderbuffer); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 return m_gl->CheckFramebufferStatus(GL_FRAMEBUFFER) == | 871 return m_gl->CheckFramebufferStatus(GL_FRAMEBUFFER) == |
| 864 GL_FRAMEBUFFER_COMPLETE; | 872 GL_FRAMEBUFFER_COMPLETE; |
| 865 } | 873 } |
| 866 | 874 |
| 867 void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) { | 875 void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) { |
| 868 ScopedStateRestorer scopedStateRestorer(this); | 876 ScopedStateRestorer scopedStateRestorer(this); |
| 869 clearFramebuffersInternal(clearMask); | 877 clearFramebuffersInternal(clearMask); |
| 870 } | 878 } |
| 871 | 879 |
| 872 void DrawingBuffer::clearFramebuffersInternal(GLbitfield clearMask) { | 880 void DrawingBuffer::clearFramebuffersInternal(GLbitfield clearMask) { |
| 881 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 882 CHECK(m_stateRestorer); |
| 873 m_stateRestorer->setFramebufferBindingDirty(); | 883 m_stateRestorer->setFramebufferBindingDirty(); |
| 874 // We will clear the multisample FBO, but we also need to clear the | 884 // We will clear the multisample FBO, but we also need to clear the |
| 875 // non-multisampled buffer. | 885 // non-multisampled buffer. |
| 876 if (m_multisampleFBO) { | 886 if (m_multisampleFBO) { |
| 877 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 887 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 878 m_gl->Clear(GL_COLOR_BUFFER_BIT); | 888 m_gl->Clear(GL_COLOR_BUFFER_BIT); |
| 879 } | 889 } |
| 880 | 890 |
| 881 m_gl->BindFramebuffer(GL_FRAMEBUFFER, | 891 m_gl->BindFramebuffer(GL_FRAMEBUFFER, |
| 882 m_multisampleFBO ? m_multisampleFBO : m_fbo); | 892 m_multisampleFBO ? m_multisampleFBO : m_fbo); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 898 | 908 |
| 899 return adjustedSize; | 909 return adjustedSize; |
| 900 } | 910 } |
| 901 | 911 |
| 902 bool DrawingBuffer::resize(const IntSize& newSize) { | 912 bool DrawingBuffer::resize(const IntSize& newSize) { |
| 903 ScopedStateRestorer scopedStateRestorer(this); | 913 ScopedStateRestorer scopedStateRestorer(this); |
| 904 return resizeFramebufferInternal(newSize); | 914 return resizeFramebufferInternal(newSize); |
| 905 } | 915 } |
| 906 | 916 |
| 907 bool DrawingBuffer::resizeFramebufferInternal(const IntSize& newSize) { | 917 bool DrawingBuffer::resizeFramebufferInternal(const IntSize& newSize) { |
| 918 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 919 CHECK(m_stateRestorer); |
| 908 CHECK(!newSize.isEmpty()); | 920 CHECK(!newSize.isEmpty()); |
| 909 IntSize adjustedSize = adjustSize(newSize, m_size, m_maxTextureSize); | 921 IntSize adjustedSize = adjustSize(newSize, m_size, m_maxTextureSize); |
| 910 if (adjustedSize.isEmpty()) | 922 if (adjustedSize.isEmpty()) |
| 911 return false; | 923 return false; |
| 912 | 924 |
| 913 if (adjustedSize != m_size) { | 925 if (adjustedSize != m_size) { |
| 914 do { | 926 do { |
| 915 if (!resizeDefaultFramebuffer(adjustedSize)) { | 927 if (!resizeDefaultFramebuffer(adjustedSize)) { |
| 916 adjustedSize.scale(s_resourceAdjustedRatio); | 928 adjustedSize.scale(s_resourceAdjustedRatio); |
| 917 continue; | 929 continue; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 | 965 |
| 954 void DrawingBuffer::resolveAndBindForReadAndDraw() { | 966 void DrawingBuffer::resolveAndBindForReadAndDraw() { |
| 955 { | 967 { |
| 956 ScopedStateRestorer scopedStateRestorer(this); | 968 ScopedStateRestorer scopedStateRestorer(this); |
| 957 resolveMultisampleFramebufferInternal(); | 969 resolveMultisampleFramebufferInternal(); |
| 958 } | 970 } |
| 959 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 971 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 960 } | 972 } |
| 961 | 973 |
| 962 void DrawingBuffer::resolveMultisampleFramebufferInternal() { | 974 void DrawingBuffer::resolveMultisampleFramebufferInternal() { |
| 975 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 976 CHECK(m_stateRestorer); |
| 963 m_stateRestorer->setFramebufferBindingDirty(); | 977 m_stateRestorer->setFramebufferBindingDirty(); |
| 964 if (wantExplicitResolve() && !m_contentsChangeCommitted) { | 978 if (wantExplicitResolve() && !m_contentsChangeCommitted) { |
| 965 m_stateRestorer->setClearStateDirty(); | 979 m_stateRestorer->setClearStateDirty(); |
| 966 m_gl->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO); | 980 m_gl->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO); |
| 967 m_gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_fbo); | 981 m_gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_fbo); |
| 968 m_gl->Disable(GL_SCISSOR_TEST); | 982 m_gl->Disable(GL_SCISSOR_TEST); |
| 969 | 983 |
| 970 int width = m_size.width(); | 984 int width = m_size.width(); |
| 971 int height = m_size.height(); | 985 int height = m_size.height(); |
| 972 // Use NEAREST, because there is no scale performed during the blit. | 986 // Use NEAREST, because there is no scale performed during the blit. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1075 |
| 1062 pixels.transfer(contents); | 1076 pixels.transfer(contents); |
| 1063 return true; | 1077 return true; |
| 1064 } | 1078 } |
| 1065 | 1079 |
| 1066 void DrawingBuffer::readBackFramebuffer(unsigned char* pixels, | 1080 void DrawingBuffer::readBackFramebuffer(unsigned char* pixels, |
| 1067 int width, | 1081 int width, |
| 1068 int height, | 1082 int height, |
| 1069 ReadbackOrder readbackOrder, | 1083 ReadbackOrder readbackOrder, |
| 1070 WebGLImageConversion::AlphaOp op) { | 1084 WebGLImageConversion::AlphaOp op) { |
| 1085 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 1086 CHECK(m_stateRestorer); |
| 1071 m_stateRestorer->setPixelPackAlignmentDirty(); | 1087 m_stateRestorer->setPixelPackAlignmentDirty(); |
| 1072 m_gl->PixelStorei(GL_PACK_ALIGNMENT, 1); | 1088 m_gl->PixelStorei(GL_PACK_ALIGNMENT, 1); |
| 1073 m_gl->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 1089 m_gl->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
| 1074 | 1090 |
| 1075 size_t bufferSize = 4 * width * height; | 1091 size_t bufferSize = 4 * width * height; |
| 1076 | 1092 |
| 1077 if (readbackOrder == ReadbackSkia) { | 1093 if (readbackOrder == ReadbackSkia) { |
| 1078 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT | 1094 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT |
| 1079 // Swizzle red and blue channels to match SkBitmap's byte ordering. | 1095 // Swizzle red and blue channels to match SkBitmap's byte ordering. |
| 1080 // TODO(kbr): expose GL_BGRA as extension. | 1096 // TODO(kbr): expose GL_BGRA as extension. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1105 uint8_t* rowA = framebuffer + i * rowBytes; | 1121 uint8_t* rowA = framebuffer + i * rowBytes; |
| 1106 uint8_t* rowB = framebuffer + (height - i - 1) * rowBytes; | 1122 uint8_t* rowB = framebuffer + (height - i - 1) * rowBytes; |
| 1107 memcpy(scanline.data(), rowB, rowBytes); | 1123 memcpy(scanline.data(), rowB, rowBytes); |
| 1108 memcpy(rowB, rowA, rowBytes); | 1124 memcpy(rowB, rowA, rowBytes); |
| 1109 memcpy(rowA, scanline.data(), rowBytes); | 1125 memcpy(rowA, scanline.data(), rowBytes); |
| 1110 } | 1126 } |
| 1111 } | 1127 } |
| 1112 | 1128 |
| 1113 RefPtr<DrawingBuffer::ColorBuffer> DrawingBuffer::createColorBuffer( | 1129 RefPtr<DrawingBuffer::ColorBuffer> DrawingBuffer::createColorBuffer( |
| 1114 const IntSize& size) { | 1130 const IntSize& size) { |
| 1131 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 1132 CHECK(m_stateRestorer); |
| 1115 m_stateRestorer->setFramebufferBindingDirty(); | 1133 m_stateRestorer->setFramebufferBindingDirty(); |
| 1116 m_stateRestorer->setTextureBindingDirty(); | 1134 m_stateRestorer->setTextureBindingDirty(); |
| 1117 | 1135 |
| 1118 // Select the Parameters for the texture object. Allocate the backing | 1136 // Select the Parameters for the texture object. Allocate the backing |
| 1119 // GpuMemoryBuffer and GLImage, if one is going to be used. | 1137 // GpuMemoryBuffer and GLImage, if one is going to be used. |
| 1120 ColorBufferParameters parameters; | 1138 ColorBufferParameters parameters; |
| 1121 GLuint imageId = 0; | 1139 GLuint imageId = 0; |
| 1122 if (shouldUseChromiumImage()) { | 1140 if (shouldUseChromiumImage()) { |
| 1123 parameters = gpuMemoryBufferColorBufferParameters(); | 1141 parameters = gpuMemoryBufferColorBufferParameters(); |
| 1124 imageId = m_gl->CreateGpuMemoryBufferImageCHROMIUM( | 1142 imageId = m_gl->CreateGpuMemoryBufferImageCHROMIUM( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 m_gl->Clear(GL_COLOR_BUFFER_BIT); | 1196 m_gl->Clear(GL_COLOR_BUFFER_BIT); |
| 1179 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 1197 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 1180 parameters.target, 0, 0); | 1198 parameters.target, 0, 0); |
| 1181 m_gl->DeleteFramebuffers(1, &fbo); | 1199 m_gl->DeleteFramebuffers(1, &fbo); |
| 1182 } | 1200 } |
| 1183 | 1201 |
| 1184 return adoptRef(new ColorBuffer(this, parameters, size, textureId, imageId)); | 1202 return adoptRef(new ColorBuffer(this, parameters, size, textureId, imageId)); |
| 1185 } | 1203 } |
| 1186 | 1204 |
| 1187 void DrawingBuffer::attachColorBufferToReadFramebuffer() { | 1205 void DrawingBuffer::attachColorBufferToReadFramebuffer() { |
| 1206 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 1207 CHECK(m_stateRestorer); |
| 1188 m_stateRestorer->setFramebufferBindingDirty(); | 1208 m_stateRestorer->setFramebufferBindingDirty(); |
| 1189 m_stateRestorer->setTextureBindingDirty(); | 1209 m_stateRestorer->setTextureBindingDirty(); |
| 1190 | 1210 |
| 1191 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 1211 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 1192 | 1212 |
| 1193 GLenum target = m_backColorBuffer->parameters.target; | 1213 GLenum target = m_backColorBuffer->parameters.target; |
| 1194 GLenum id = m_backColorBuffer->textureId; | 1214 GLenum id = m_backColorBuffer->textureId; |
| 1195 | 1215 |
| 1196 m_gl->BindTexture(target, id); | 1216 m_gl->BindTexture(target, id); |
| 1197 | 1217 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1221 if (contextProvider() | 1241 if (contextProvider() |
| 1222 ->getCapabilities() | 1242 ->getCapabilities() |
| 1223 .disable_webgl_rgb_multisampling_usage) | 1243 .disable_webgl_rgb_multisampling_usage) |
| 1224 return GL_RGBA8_OES; | 1244 return GL_RGBA8_OES; |
| 1225 return GL_RGB8_OES; | 1245 return GL_RGB8_OES; |
| 1226 } | 1246 } |
| 1227 | 1247 |
| 1228 DrawingBuffer::ScopedStateRestorer::ScopedStateRestorer( | 1248 DrawingBuffer::ScopedStateRestorer::ScopedStateRestorer( |
| 1229 DrawingBuffer* drawingBuffer) | 1249 DrawingBuffer* drawingBuffer) |
| 1230 : m_drawingBuffer(drawingBuffer) { | 1250 : m_drawingBuffer(drawingBuffer) { |
| 1231 DCHECK(!m_drawingBuffer->m_stateRestorer); | 1251 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 1252 CHECK(!m_drawingBuffer->m_stateRestorer); |
| 1232 m_drawingBuffer->m_stateRestorer = this; | 1253 m_drawingBuffer->m_stateRestorer = this; |
| 1233 } | 1254 } |
| 1234 | 1255 |
| 1235 DrawingBuffer::ScopedStateRestorer::~ScopedStateRestorer() { | 1256 DrawingBuffer::ScopedStateRestorer::~ScopedStateRestorer() { |
| 1257 // TODO(ccameron): Make this a DCHECK after fixing crbug.com/658265 |
| 1258 CHECK_EQ(m_drawingBuffer->m_stateRestorer, this); |
| 1236 m_drawingBuffer->m_stateRestorer = nullptr; | 1259 m_drawingBuffer->m_stateRestorer = nullptr; |
| 1237 Client* client = m_drawingBuffer->m_client; | 1260 Client* client = m_drawingBuffer->m_client; |
| 1238 if (!client) | 1261 if (!client) |
| 1239 return; | 1262 return; |
| 1240 | 1263 |
| 1241 if (m_clearStateDirty) { | 1264 if (m_clearStateDirty) { |
| 1242 client->DrawingBufferClientRestoreScissorTest(); | 1265 client->DrawingBufferClientRestoreScissorTest(); |
| 1243 client->DrawingBufferClientRestoreMaskAndClearValues(); | 1266 client->DrawingBufferClientRestoreMaskAndClearValues(); |
| 1244 } | 1267 } |
| 1245 if (m_pixelPackAlignmentDirty) | 1268 if (m_pixelPackAlignmentDirty) |
| 1246 client->DrawingBufferClientRestorePixelPackAlignment(); | 1269 client->DrawingBufferClientRestorePixelPackAlignment(); |
| 1247 if (m_textureBindingDirty) | 1270 if (m_textureBindingDirty) |
| 1248 client->DrawingBufferClientRestoreTexture2DBinding(); | 1271 client->DrawingBufferClientRestoreTexture2DBinding(); |
| 1249 if (m_renderbufferBindingDirty) | 1272 if (m_renderbufferBindingDirty) |
| 1250 client->DrawingBufferClientRestoreRenderbufferBinding(); | 1273 client->DrawingBufferClientRestoreRenderbufferBinding(); |
| 1251 if (m_framebufferBindingDirty) | 1274 if (m_framebufferBindingDirty) |
| 1252 client->DrawingBufferClientRestoreFramebufferBinding(); | 1275 client->DrawingBufferClientRestoreFramebufferBinding(); |
| 1253 if (m_pixelUnpackBufferBindingDirty) | 1276 if (m_pixelUnpackBufferBindingDirty) |
| 1254 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); | 1277 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); |
| 1255 } | 1278 } |
| 1256 | 1279 |
| 1257 bool DrawingBuffer::shouldUseChromiumImage() { | 1280 bool DrawingBuffer::shouldUseChromiumImage() { |
| 1258 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && | 1281 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && |
| 1259 m_chromiumImageUsage == AllowChromiumImage; | 1282 m_chromiumImageUsage == AllowChromiumImage; |
| 1260 } | 1283 } |
| 1261 | 1284 |
| 1262 } // namespace blink | 1285 } // namespace blink |
| OLD | NEW |