Fix DataSourceSurface mapping in PaintCounter. (bug 1405390 part 4, r=bas)
authorDavid Anderson <danderson@mozilla.com>
Thu, 09 Nov 2017 00:43:31 -0800
changeset 444265 074d85a019df6bf4014f16351629a7975f8a6cf9
parent 444264 b804f968bd3260a45982e4a3d59d7976d31df1b5
child 444266 7fbad8fbfd1d9d42ddbddce757751fdd45755785
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1405390
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix DataSourceSurface mapping in PaintCounter. (bug 1405390 part 4, r=bas)
gfx/layers/composite/PaintCounter.cpp
gfx/layers/composite/PaintCounter.h
--- a/gfx/layers/composite/PaintCounter.cpp
+++ b/gfx/layers/composite/PaintCounter.cpp
@@ -23,21 +23,22 @@ using namespace mozilla::gfx;
 
 // Positioned below the chrome UI
 IntRect PaintCounter::mRect = IntRect(0, 175, 300, 60);
 
 PaintCounter::PaintCounter()
 {
   mFormat = SurfaceFormat::B8G8R8A8;
   mSurface = Factory::CreateDataSourceSurface(mRect.Size(), mFormat);
-  mStride = mSurface->Stride();
+  mMap.emplace(mSurface, DataSourceSurface::READ_WRITE);
+  mStride = mMap->GetStride();
 
   mCanvas =
     SkCanvas::MakeRasterDirect(MakeSkiaImageInfo(mRect.Size(), mFormat),
-                              mSurface->GetData(), mStride);
+                              mMap->GetData(), mStride);
   mCanvas->clear(SK_ColorWHITE);
 }
 
 PaintCounter::~PaintCounter()
 {
   mSurface = nullptr;
   mTextureSource = nullptr;
   mTexturedEffect = nullptr;
--- a/gfx/layers/composite/PaintCounter.h
+++ b/gfx/layers/composite/PaintCounter.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_layers_PaintCounter_h_
 #define mozilla_layers_PaintCounter_h_
 
 #include <map>                          // for std::map
+#include "mozilla/Maybe.h"
 #include "mozilla/RefPtr.h"             // for already_AddRefed, RefCounted
 #include "mozilla/TimeStamp.h"          // for TimeStamp, TimeDuration
 #include "skia/include/core/SkCanvas.h"
 
 namespace mozilla {
 namespace layers {
 
 class Compositor;
@@ -36,15 +37,16 @@ private:
   SurfaceFormat mFormat;
   std::unique_ptr<SkCanvas> mCanvas;
   IntSize mSize;
   int mStride;
 
   RefPtr<DataSourceSurface> mSurface;
   RefPtr<DataTextureSource> mTextureSource;
   RefPtr<TexturedEffect> mTexturedEffect;
+  Maybe<DataSourceSurface::ScopedMap> mMap;
   static IntRect mRect;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // mozilla_layers_opengl_PaintCounter_h_