mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-10 18:32:47 +08:00
fix preferences::load(std::string)
This commit is contained in:
parent
a04c87ae0d
commit
f1926feba2
@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <unistd.h>
|
||||
#include <cdtypes.h>
|
||||
#include <cdlog.h>
|
||||
#include <expat.h>
|
||||
@ -56,9 +57,11 @@ static void endElement(void *userData, const XML_Char *name){
|
||||
|
||||
void Preferences::load(const std::string&fname){
|
||||
std::ifstream fin(fname);
|
||||
if(fin.good()){
|
||||
if(access(fname.c_str(),F_OK)==0){
|
||||
mFileName=fname;
|
||||
load(fin);
|
||||
}else if(fname.find("<sections>")!=std::string::npos){
|
||||
load(fname.c_str(),fname.length());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,14 +44,10 @@ AnimatedRotateDrawable::AnimatedRotateDrawable(std::shared_ptr<AnimatedRotateSta
|
||||
updateLocalState();
|
||||
mNextFrame = [this](){
|
||||
mCurrentDegrees += mIncrement;
|
||||
if (mIncrement < 0) {
|
||||
if (mCurrentDegrees < -1 * (360.0f + mIncrement)) {
|
||||
mCurrentDegrees = 0.0f;
|
||||
}
|
||||
} else {
|
||||
if (mCurrentDegrees > (360.0f - mIncrement)) {
|
||||
mCurrentDegrees = 0.0f;
|
||||
}
|
||||
if( (mIncrement < 0) && (mCurrentDegrees < -360.f - mIncrement) ){
|
||||
mCurrentDegrees = 0.f;
|
||||
}else if ((mIncrement > 0) && (mCurrentDegrees > 360.0f - mIncrement)) {
|
||||
mCurrentDegrees = 0.0f;
|
||||
}
|
||||
invalidateSelf();
|
||||
nextFrame();
|
||||
@ -205,6 +201,6 @@ Drawable*AnimatedRotateDrawable::inflate(Context*ctx,const AttributeSet&atts){
|
||||
Drawable*child = createWrappedDrawable(ctx,atts);
|
||||
ad->setDrawable(child);
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ Window::Window(int x,int y,int width,int height,int type)
|
||||
WindowManager::getInstance().getDefaultDisplay().getSize(size);
|
||||
if(width<0) width = size.x;
|
||||
if(height<0) height= size.y;
|
||||
|
||||
setBackground(nullptr);
|
||||
setFrame(x, y, width, height);
|
||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||
setFocusable(true);
|
||||
|
@ -607,7 +607,7 @@ bool ImageView::isOpaque() const{
|
||||
}
|
||||
|
||||
static bool isRectilinear(const Cairo::Matrix& matrix) {
|
||||
// 判断矩阵是否保持矩形形状
|
||||
// 判断矩阵是否保持矩形形状
|
||||
if ((matrix.xx == 0) || (matrix.yy == 0) || (matrix.yx != 0) || (matrix.xy != 0) ) {
|
||||
return false;
|
||||
}
|
||||
@ -721,7 +721,7 @@ void ImageView::updateDrawable(Drawable*d){
|
||||
|
||||
void ImageView::setImageBitmap(RefPtr<ImageSurface>bitmap){
|
||||
if(mDrawable!=mRecycleableBitmapDrawable)
|
||||
delete mDrawable;
|
||||
delete mDrawable;
|
||||
mDrawable = nullptr;
|
||||
if (mRecycleableBitmapDrawable == nullptr) {
|
||||
mRecycleableBitmapDrawable = new BitmapDrawable(bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user