Move non-trivial constructors out-of-line.
There is more than one way to skin this SkPathPriv.h cat. These constructors are large enough that they probably shouldn't have been inlined like this anyway. BUG=skia:4126 Review URL: https://codereview.chromium.org/1253963004
This commit is contained in:
parent
3ae4701fe8
commit
e88b1fb7a5
@ -168,6 +168,7 @@
|
||||
'<(skia_src_path)/core/SkReadBuffer.cpp',
|
||||
'<(skia_src_path)/core/SkReader32.h',
|
||||
'<(skia_src_path)/core/SkRecord.cpp',
|
||||
'<(skia_src_path)/core/SkRecords.cpp',
|
||||
'<(skia_src_path)/core/SkRecordDraw.cpp',
|
||||
'<(skia_src_path)/core/SkRecordOpts.cpp',
|
||||
'<(skia_src_path)/core/SkRecorder.cpp',
|
||||
|
32
src/core/SkRecords.cpp
Normal file
32
src/core/SkRecords.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkPathPriv.h"
|
||||
#include "SkRecords.h"
|
||||
|
||||
namespace SkRecords {
|
||||
ImmutableBitmap::ImmutableBitmap(const SkBitmap& bitmap) {
|
||||
if (bitmap.isImmutable()) {
|
||||
fBitmap = bitmap;
|
||||
} else {
|
||||
bitmap.copyTo(&fBitmap);
|
||||
}
|
||||
fBitmap.setImmutable();
|
||||
}
|
||||
|
||||
PreCachedPath::PreCachedPath(const SkPath& path) : SkPath(path) {
|
||||
this->updateBoundsCache();
|
||||
#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
|
||||
SkPathPriv::FirstDirection junk;
|
||||
(void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
|
||||
#endif
|
||||
}
|
||||
|
||||
TypedMatrix::TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) {
|
||||
(void)this->getType();
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkPathPriv.h"
|
||||
#include "SkPicture.h"
|
||||
#include "SkRSXform.h"
|
||||
#include "SkTextBlob.h"
|
||||
@ -205,14 +204,7 @@ private:
|
||||
class ImmutableBitmap : SkNoncopyable {
|
||||
public:
|
||||
ImmutableBitmap() {}
|
||||
explicit ImmutableBitmap(const SkBitmap& bitmap) {
|
||||
if (bitmap.isImmutable()) {
|
||||
fBitmap = bitmap;
|
||||
} else {
|
||||
bitmap.copyTo(&fBitmap);
|
||||
}
|
||||
fBitmap.setImmutable();
|
||||
}
|
||||
explicit ImmutableBitmap(const SkBitmap& bitmap);
|
||||
|
||||
int width() const { return fBitmap.width(); }
|
||||
int height() const { return fBitmap.height(); }
|
||||
@ -228,22 +220,14 @@ private:
|
||||
// Recording is a convenient time to cache these, or we can delay it to between record and playback.
|
||||
struct PreCachedPath : public SkPath {
|
||||
PreCachedPath() {}
|
||||
explicit PreCachedPath(const SkPath& path) : SkPath(path) {
|
||||
this->updateBoundsCache();
|
||||
#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
|
||||
SkPathPriv::FirstDirection junk;
|
||||
(void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
|
||||
#endif
|
||||
}
|
||||
explicit PreCachedPath(const SkPath& path);
|
||||
};
|
||||
|
||||
// Like SkPath::getBounds(), SkMatrix::getType() isn't thread safe unless we precache it.
|
||||
// This may not cover all SkMatrices used by the picture (e.g. some could be hiding in a shader).
|
||||
struct TypedMatrix : public SkMatrix {
|
||||
TypedMatrix() {}
|
||||
explicit TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) {
|
||||
(void)this->getType();
|
||||
}
|
||||
explicit TypedMatrix(const SkMatrix& matrix);
|
||||
};
|
||||
|
||||
RECORD0(NoOp);
|
||||
|
Loading…
Reference in New Issue
Block a user